【问题标题】:Apache localhost only on Ubuntu 18.04?Apache localhost 仅在 Ubuntu 18.04 上?
【发布时间】:2018-08-03 14:34:49
【问题描述】:

我想在我的桌面上运行 Apache 并且只接受 localhost 连接。我也在使用 Ubuntu 18.04。我希望我可以通过修改 Apache 的配置文件来实现这一点,我真的不想使用 IPTABLES。

【问题讨论】:

    标签: apache localhost ubuntu-18.04


    【解决方案1】:

    打开终端并编辑文件000-default.conf

    sudo nano /etc/apache2/sites-available/000-default.conf
    

    然后将以下两行添加到块<Directory /var/www/html/>

    Require host localhost
    Require ip 127.0.0.1
    

    应该是这样的:

    <Directory /var/www/html/>
        AllowOverride All
        # ... other configurations ...
        Require host localhost
        Require ip 127.0.0.1
    </Directory>
    

    保存并退出文件,然后重启apache2服务

    sudo systemctl restart apache2
    

    【讨论】:

      猜你喜欢
      • 2021-09-17
      • 1970-01-01
      • 1970-01-01
      • 2018-10-11
      • 2019-06-05
      • 2020-10-23
      • 1970-01-01
      • 2019-05-05
      • 2021-12-01
      相关资源
      最近更新 更多