【问题标题】:Apache 2 DNS redirects to internal IPApache 2 DNS 重定向到内部 IP
【发布时间】:2019-04-01 23:17:24
【问题描述】:

Ubuntu 18.04 && Apache 2.4.29

安装了 LAMP 和 WordPress,我可以通过192.168.1.80 访问。

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

这是我的 Apache2 站点配置:

(将 xx 替换为我的实际 DNS)

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

找不到此问题的解决方案。

【问题讨论】:

    标签: dns webserver apache2 ubuntu-18.04


    【解决方案1】:

    你的服务器别名需要改成

    ServerName  xx.ddns.net   
    ServerAlias xx.ddns.net
    

    【讨论】:

      猜你喜欢
      • 2011-04-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-13
      • 2021-08-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多