紫禁城您没有权限访问此服务器上。 CentOS 6的/ Laravel 4 [英] Forbidden You don't have permission to access on this server. Centos 6 / Laravel 4

查看:434
本文介绍了紫禁城您没有权限访问此服务器上。 CentOS 6的/ Laravel 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题后,我完成设立LAMP和安装我的laravel 4的应用程序。一切似乎都很顺利,当我在我的IP地址的网址去,这显示了我正确的应用程序的第一页,但页面的其余全部扔给我一个404错误的请求的URL没有在此服务器上找到。

i got a problem after i finish to set up LAMP and installed my laravel 4 application. Everything seem went well, when i go on my ip address url, it show me the first page of my application correctly, but all the rest of the page throw me an 404 error The requested URL was not found on this server.

所以,我加入到我的httpd.conf(我的项目的虚拟主机下) -
所有的AllowOverride
为了允许,拒绝

So I added to my httpd.conf (under the virtual host of my project) - AllowOverride All Order allow,deny

<VirtualHost *:80>
        ServerName VPS-IP-ADDRESS
        DocumentRoot /var/www/html/nextmatch/public_html/public/

       <Directory /var/www/html/nextmatch/public_html/public/>
         AllowOverride all
         Order allow,deny
          <IfModule mod_rewrite.c>
          Options -MultiViews
          RewriteEngine On
          RewriteCond %{REQUEST_FILENAME} !-f
         RewriteRule ^ index.php [L]
       </IfModule>
</Directory>
</VirtualHost>

,现在当我尝试,而不是浏览404错误我得到了故宫
您没有权限访问该服务器。
我设置了搭配chmod 775 -R路径/ laravel / 和文件夹存储777,但仍然我得到了同样的错误提示任何好吗?我想不通这个问题我得到疯了!感谢您的任何帮助。

And now when i try to navigate instead the 404 error i got Forbidden You don't have permission to access this server. I set up with chmod 775 -R path/laravel/ and the folder storage with 777 but still i got the same error any suggest please? I cannot figure out to this problem i'm getting crazy! Thank you for any help.

推荐答案

网络服务器开始作为一个特定的用户下一个守护进程(服务)。该用户在httpd.conf中定义。默认情况下该用户将阿帕奇。不要混淆httpd进程apache用户。后者是一个网络服务器守护程序和前者下它要运行用户。如果您创建的文件夹属于root或比httpd.conf中定义的其他用户则Apache将无法访问它。找出这个问题的方法是去到该文件夹​​并做ls -l命令。如果用户定义的httpd.conf就是Apache那么为了它访问文件夹,你应该看到:

The webserver starts as a daemon (service) under a particular user. That user is defined in httpd.conf. By default that user will be apache. Don't confuse the apache user with the httpd process. The latter is a webserver daemon and the former is the user under which it is going to run. If the folder you created belongs to root or a user other than the one defined in httpd.conf then apache won't be able to access it. The way to identify this problem is to go to the folder and do ls -l. If the user define in httpd.conf is apache then in order for it to access the folder, you should see:

drwxr-xr-x.  2 apache apache    4096 Jan  8  2013 public_folder

请注意,它说阿帕奇阿帕奇,这意味着它属于Apache用户和组。如果通过根目录中创建它,那么你可能会看到:

Note, it says 'apache apache', meaning it belongs to the apache user and group. If you created it via root then you will probably see:

drwxr-xr-x.  2 root root    4096 Jan  8  2013 public_folder

Apache用户无法访问由根定义的文件夹。为了解决这个问题,运行以下命令:

The apache user cannot access the folder defined by root. To solve this problem run the command:

chown -R apache:apache myfolder

-R选项是递归的,所以它会更新该文件夹以apache用户中的所有文件夹和文件的所有权。

The -R option is recursive, so it will update ownership for ALL folders and files within that folder to the apache user.

如果您拥有罚款,如果,然后试图暂时关闭SELinux的。在CentOS你做的:

If your ownership if fine, then trying 'temporarily' turning off selinux. On centos you do:

setenforce 0

这将关闭SELinux的,直到下次重新启动。理想情况下,你会想离开SELinux在额外的安全性,并设置一个有效的上下文为你的apache文件和文件夹。

Which will turn off selinux till the next restart. Ideally, you will want to leave selinux on for additional security and set a valid context for your apache files and folders.

这篇关于紫禁城您没有权限访问此服务器上。 CentOS 6的/ Laravel 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆