这几天我和我的http://localhost 工作一起睡觉,并阅读/var/www...
我在Apache2日志中发现了"AH00094"错误,并且(Apache2创建了?)惊讶/var/www/html,Apache2尝试使用.
现在我http://localhost/anything不行(浏览器错误404).
怎么解决?我需要回复我的http://localhost文件处理/var/www!
我正在使用Ubuntu12和Apache2,所有默认和标准.
我检查了错误日志,tail /var/log/apache2/error.log以找出Apache所显示的确切路径
... [core:notice] [pid 1597] AH00094: Command line: '/usr/sbin/apache2'
... [:error] [pid 1604] [client 127.0.0.1:40624] script '/var/www/html/info.php' not found or unable to stat
Run Code Online (Sandbox Code Playgroud)
该文件夹 /var/www/html是新的,全部,如'/var/www/info.php',是/var/www,而不是/var/www/html.
sudo nano /etc/apache2/apache2.conf
Run Code Online (Sandbox Code Playgroud)
并在最后一行添加
ServerName localhost
Run Code Online (Sandbox Code Playgroud)
(现在没有关于localhost的日志错误,但没有任何作用)
PS:我检查了其他相关问题,但不是同一个问题:/ var/www/html的权限,试图使用var/www/html的符号链接
我害怕使用这个答案的线索 ......在我的Ubuntu中没有.conf指示的文件.我必须创造它吗?安全吗?
正如@RahilWazir建议的那样,这里也是我的"/etc/apache2/sites-available/000-default.conf",
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Run Code Online (Sandbox Code Playgroud)
看这里:
为什么将apache2 www目录移动到/ var/www/html?
显然(我们也很惊讶)默认目录从Debian 转移/var/www到/var/www/htmlhtdocs,Ubuntu复制了这个更改.给出的理由有些合理,但升级路径可能"有趣"(如中国谚语中)......正如您所遇到的那样.
| 归档时间: |
|
| 查看次数: |
14004 次 |
| 最近记录: |