我全新安装了 Ubuntu 16.04 LTS Server(32 位),并启用了 LAMP 软件包。这意味着开箱即用,它在端口 80 上提供典型的 Apache2 Ubuntu 默认页面,位于/var/www/html/index.html.
我做的第一件事就是尝试使用古老的方法禁用该页面
\n\nsudo a2dissite 000-default.conf\nRun Code Online (Sandbox Code Playgroud)\n\n命令,这提示我做
\n\nservice apache2 reload\nRun Code Online (Sandbox Code Playgroud)\n\n我也用 来调用sudo。
令我惊讶的是,之后该网站仍然可以访问:在 Firefox 中重新加载和切换重新加载仍然显示该页面,并且我可以在/var/log/apache2/other_vhosts_access.log.
a2dissite再次运行命令显示Site 000-default already disabled目录/etc/apache2/sites-enabled/为空。
我究竟做错了什么?
\n\n编辑:
\n\n至于Julius \xc5\xa0 的建议。,我也尝试过
\n\nsudo service apache2 restart\nRun Code Online (Sandbox Code Playgroud)\n\n具有相同的结果并检查了我的/etc/apache2/apache2.conf文件,该文件<VirtualHost>仅在一些评论中显示。
关于<Directory>条目,这些只是文件中的默认值:
<Directory />\n Options FollowSymLinks\n AllowOverride None\n Require all denied\n</Directory>\n\n<Directory /usr/share>\n AllowOverride None\n Require all granted\n</Directory>\n\n<Directory /var/www/>\n Options Indexes FollowSymLinks\n AllowOverride None\n Require all granted\n</Directory>\n\n#<Directory /srv/>\n# Options Indexes FollowSymLinks\n# AllowOverride None\n# Require all granted\n#</Directory>\nRun Code Online (Sandbox Code Playgroud)\n\n可能是某些插件在/var/www/子文件夹中搜索合适的 html 文件吗?
编辑2:
\n\n我也reboot编辑了机器,该网站仍然可以访问。
只有停止该服务才会使其变得无法访问。由于我计划在其上运行其他站点,因此我最终需要让它运行,所以我真的很好奇发生了什么。
\n\n编辑3:
\n\n正如我在SO 上的这个答案中发现的那样,配置文件中的虚拟主机设置可以显示如下:
\n\n. /etc/apache2/envvars\napache2 -S\nRun Code Online (Sandbox Code Playgroud)\n\n...就我而言,输出以下内容:
\n\nAH00558: apache2: Could not reliably determine the server\'s fully qualified domain name, using 127.0.1.1. Set the \'ServerName\' directive globally to suppress this message\nVirtualHost configuration:\nServerRoot: "/etc/apache2"\nMain DocumentRoot: "/var/www/html"\nMain ErrorLog: "/var/log/apache2/error.log"\nMutex mpm-accept: using_defaults\nMutex watchdog-callback: using_defaults\nMutex default: dir="/var/lock/apache2" mechanism=fcntl \nPidFile: "/var/run/apache2/apache2.pid"\nDefine: DUMP_VHOSTS\nDefine: DUMP_RUN_CFG\nUser: name="www-data" id=33 not_used\nGroup: name="www-data" id=33 not_used\nRun Code Online (Sandbox Code Playgroud)\n\nDocumentRoot我对指向的条目有点怀疑/var/www/html,所以我做了一个
find |xargs grep DocumentRoot 2>/dev/null\nRun Code Online (Sandbox Code Playgroud)\n\n在/etc/apache2文件夹中,这导致了以下结果:
./sites-available/default-ssl.conf: DocumentRoot /var/www/html\n./sites-available/000-default.conf: DocumentRoot /var/www/html\nRun Code Online (Sandbox Code Playgroud)\n\n...所以*-enabled/包含该字符串的任何子文件夹中都没有任何内容。我真的很想知道DocumentRoot当什么都没有启用时 Apache 从哪里得到的。
| 归档时间: |
|
| 查看次数: |
29327 次 |
| 最近记录: |