【问题标题】:access to apache2 website using domain name and not server's IP使用域名而不是服务器的 IP 访问 apache2 网站
【发布时间】:2014-09-11 02:22:57
【问题描述】:

如标题所示,我想只使用域名而不是服务器的IP访问apache2网站。

我想在尝试使用服务器 IP 访问网站时收到错误 403。

这怎么可能?

谢谢

【问题讨论】:

    标签: apache .htaccess ip


    【解决方案1】:

    在这个帖子的帮助下,我成功了:https://serverfault.com/questions/511...uses-the-ip-ad

    最后,我将它添加到 /etc/apache2/sites-available/default.conf:

            <Directory /var/www/>
    
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^xx\.xx\.xx\.xx
    RewriteRule ^(.*)$ - [F,L]
    
    [...]
            </Directory>
    

    现在,直接输入我的 IP 地址时出现 403 错误,我只能通过输入域名来访问我的网站。

    谢谢大家。

    【讨论】:

      猜你喜欢
      • 2018-04-23
      • 2015-01-01
      • 1970-01-01
      • 2020-08-21
      • 2011-01-10
      • 1970-01-01
      • 2022-10-15
      • 2021-06-06
      • 2017-04-11
      相关资源
      最近更新 更多