Ubuntu 18.04 && Apache 2.4.29
已安装LAMP和WordPress,我可以访问192.168.1.80
槽。
已在路由器上打开端口80,并在here上进行了检查。
这是我的Apache2站点配置:
(用我的实际DNS替换了xx)
<VirtualHost *:80>
ServerAdmin xx.ddns.net
ServerName xx.ddns.net
ServerAlias www.xx.ddns.net
DocumentRoot /var/www/wordpress
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/wordpress/>
AllowOverride All
</Directory>
</VirtualHost>
检查Ubuntu是否在监听:
root@ubuntudiogo:~# sudo iptables -L -nv
Chain INPUT (policy ACCEPT 479 packets, 42264 bytes)
pkts bytes target prot opt in out source destination
79 15269 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 402 packets, 55621 bytes)
pkts bytes target prot opt in out source destination
在本地,一切正常。当我尝试通过外部访问它时 网络(在这种情况下,我的手机通过4G)将页面重定向到 内部IP。
找不到解决此问题的方法。
答案 0 :(得分:0)
您的服务器别名需要更改为
ServerName xx.ddns.net
ServerAlias xx.ddns.net