Apache 2 DNS重定向到内部IP

问题描述 投票:0回答:1

Ubuntu 18.04 && Apache 2.4.29

安装LAMP和WordPress,我可以通过qazxsw poi访问。

已在路由器上打开端口80并在192.168.1.80上进行了检查。

这是我的Apache2站点配置:

(用我的实际DNS替换xx)

here

检查Ubuntu是否在监听:

<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>

在当地一切正常。当我尝试通过外部网络访问它(在这种情况下我的手机通过4G)页面重定向到我的内部IP。

找不到解决这个问题的方法。

dns webserver apache2 ubuntu-18.04
1个回答
0
投票

您的服务器别名需要更改为

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
© www.soinside.com 2019 - 2024. All rights reserved.