我有一个安装在Debian 7 vps上的vanilla apache2服务器。 在sites-enabled文件夹中,我为特定的子域创build了一个文件。 它正在工作,并在正确的文档根目录下显示正确的文件,但是在index.html页面请求的任何静态资源上都会收到403个Forbidden错误。 我的configuration文件如下:
<VirtualHost *:80> ServerName foo.bar.net ServerAlias foo.bar.net DocumentRoot /home/foobar/someLibary/demo <Directory /home/foobar/someLibary/demo> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, cric, alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
错误日志里有什么?
你还检查了文件和目录的权限吗?
如果你没有定义NameVirtualHost指令,它可能不会服从这个虚拟主机。 在这种情况下,您的系统默认值将会生效。
尝试运行httpd -S,看看输出是否有意义,它应该描述你的虚拟主机。