【发布时间】:2014-10-10 20:35:37
【问题描述】:
我刚刚设置了一个 Cent OS 6 VPS,它可以完美地运行 LAMP,直到我启用了虚拟主机。 它总是返回 403 Forbidden 错误。
我将 /etc/httpd/conf/httpd.conf 更新为以下设置:
<Directory />
# Options Indexes FollowSymLinks MultiViews Includes ExecCGI
Options FollowSymLinks
AllowOverride All
# Order deny,allow
Order allow,deny
Allow from all
# Deny from all
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks MultiViews
#AllowOverride None
AllowOverride All
Order allow,deny
Allow from all
</Directory>
NameVirtualHost *:80
我已经创建了 /etc/httpd/conf/httpd.conf 加载的 /etc/httpd/conf.d/vhosts.conf。 (我用“mydomain”替换了我的真实域名和用户名)
<VirtualHost *:80>
ServerAdmin webmaster@mydomain
DocumentRoot /home/mydomain/htdocs
<Directory /home/mydomain/htdocs>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ServerName mydomain
ServerAlias mydomain
ErrorLog /home/mydomain/logs/error.log
# CustomLog /home/mydomain/logs/access.log common
</VirtualHost>
我更改了 /var/www/html 和 /home/mydomain/htdocs 的所有者和权限。
drwxr-xr-x 3 apache apache 4096 Aug 15 14:23 html
drwxr-xr-x 2 apache apache 4096 Aug 18 10:18 htdocs
drwxr-xr-x 2 apache apache 4096 Aug 18 10:37 logs
但现在我无法通过 IP 地址访问虚拟主机,即使是根文件 (/var/www/html)。如果我关闭(删除)虚拟主机,那么我可以访问 /var/www/html 中的页面。
谁能帮帮我?
非常感谢。
【问题讨论】:
标签: php apache virtualhost http-status-code-403