Apache 虚拟主机问题
Apache virtual host issue
我试图让 Symfony 在不使用内置 PHP 服务器的情况下工作,但是,当我试图通过我的虚拟主机地址访问它时,我总是得到 403。我的虚拟主机 conf 文件如下所示:
<VirtualHost *:80>
ServerName www.symfony2.local
ServerAlias symfony2.local
DocumentRoot /var/www/vhosts/symfony2.local/web
<Directory /var/www/vhosts/symfony2.local/web>
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/symfony2-error.log
CustomLog /var/log/httpd/symfony2-access.log combined
</VirtualHost>
我的主机文件如下所示:
127.0.0.1 symfony2.local
web/中的.htaccess是Synfony2默认安装文件
每当我尝试访问 http://synfony2.local 时,我的日志文件中都会出现以下错误:
(13)Permission denied: [client 127.0.0.1:32858] AH00529: /var/www/vhosts/symfony2.local/web/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/vhosts/symfony2.local/web/' is executable
-rwxr-xr-x. 1 apache apache 2.8K Mar 1 00:48 .htaccess
drwxr-xr-x. 3 apache apache 4.0K Mar 1 01:24 web
有人可以指出我在这里遗漏了什么吗?
403 foribben 可能有多种原因。
- 减少 .htaccess 文件的权限。你错了
htaccess 文件的权限。你有它作为 755 应该在目录上使用它应该
是 644 rw-r--r--。更改。我猜这就是问题所在。
- 确保您在网站根目录中有一个索引文件。当然,如果你在那里有一个网络应用程序,那么请确保你在 Apache 配置文件中指定了
DirectoryIndex index.php
。
- 确保父文件夹是
755
symfony2.local
也已知限制访问。
选项 2 和 3 是检查选项 1 是否无法解决的问题。尽管无论如何您都需要更改 htaccess 上的权限。
的解决方案很有用,提出的观点也有效,但是并没有解决问题(虽然可能有效果)。
我终于在禁用 SeLinux 后让它工作了。
我试图让 Symfony 在不使用内置 PHP 服务器的情况下工作,但是,当我试图通过我的虚拟主机地址访问它时,我总是得到 403。我的虚拟主机 conf 文件如下所示:
<VirtualHost *:80>
ServerName www.symfony2.local
ServerAlias symfony2.local
DocumentRoot /var/www/vhosts/symfony2.local/web
<Directory /var/www/vhosts/symfony2.local/web>
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/symfony2-error.log
CustomLog /var/log/httpd/symfony2-access.log combined
</VirtualHost>
我的主机文件如下所示:
127.0.0.1 symfony2.local
web/中的.htaccess是Synfony2默认安装文件
每当我尝试访问 http://synfony2.local 时,我的日志文件中都会出现以下错误:
(13)Permission denied: [client 127.0.0.1:32858] AH00529: /var/www/vhosts/symfony2.local/web/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/vhosts/symfony2.local/web/' is executable
-rwxr-xr-x. 1 apache apache 2.8K Mar 1 00:48 .htaccess
drwxr-xr-x. 3 apache apache 4.0K Mar 1 01:24 web
有人可以指出我在这里遗漏了什么吗?
403 foribben 可能有多种原因。
- 减少 .htaccess 文件的权限。你错了 htaccess 文件的权限。你有它作为 755 应该在目录上使用它应该 是 644 rw-r--r--。更改。我猜这就是问题所在。
- 确保您在网站根目录中有一个索引文件。当然,如果你在那里有一个网络应用程序,那么请确保你在 Apache 配置文件中指定了
DirectoryIndex index.php
。 - 确保父文件夹是
755
symfony2.local
也已知限制访问。
选项 2 和 3 是检查选项 1 是否无法解决的问题。尽管无论如何您都需要更改 htaccess 上的权限。
我终于在禁用 SeLinux 后让它工作了。