duanchi4184
2016-01-29 17:59
浏览 68
已采纳

centos 6权限问题

I have a dedicated server with Centos6 and cPanel, all I want is to install Magento 2 on this server. My problem is with files and folders permissions. in the Magento 2 documentation I need to set this permissions find . -type d -exec chmod 770 {} \; && find . -type f -exec chmod 660 {} \; && chmod u+x bin/magento . when I set this permision to my home/username/public_html I get this error in browser.

Forbidden You don't have permission to access / on this server. Server unable to read htaccess file, denying access to be safe Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

is anyone who can point me in one direction to solve this? thank you

**Output**

    **ls -al /path/to/magento**

drwxr-x---. 13 nobody nobody     4096 Jan 29 18:30 ./
drwx--x--x. 10 quick  quick      4096 Jan 29 18:29 ../
drwxr-xr-x.  4 nobody root       4096 Jan 29 18:30 app/
drwxr-xr-x.  2 nobody root       4096 Jan 29 18:30 bin/
drwxr-xr-x.  2 nobody quick      4096 Jan 29 18:28 cgi-bin/
-rw-r--r--.  1 nobody root     437404 Jan 28 04:12 CHANGELOG.md
-rw-r--r--.  1 nobody root       1851 Jan 28 04:10 composer.json
-rw-r--r--.  1 nobody root     315984 Jan 28 04:12 composer.lock
-rw-r--r--.  1 nobody root       3425 Jan 28 04:12 CONTRIBUTING.md
-rw-r--r--.  1 nobody root      10011 Jan 28 04:12 CONTRIBUTOR_LICENSE_AGREEMENT.html
-rw-r--r--.  1 nobody root        631 Jan 28 04:12 COPYING.txt
drwxr-xr-x.  4 nobody root       4096 Jan 29 18:30 dev/
-rw-r--r--.  1 nobody root       1032 Jan 28 04:10 .gitignore
-rw-r--r--.  1 nobody root       2918 Jan 28 04:12 Gruntfile.js
-rw-r--r--.  1 nobody root       7592 Jan 28 04:12 .htaccess
-rw-r--r--.  1 nobody root       6419 Jan 28 04:12 .htaccess.sample
-rw-r--r--.  1 nobody root       1358 Jan 28 04:12 index.php
drwxr-xr-x.  4 nobody root       4096 Jan 29 18:30 lib/
-rw-r--r--.  1 nobody root      10374 Jan 28 04:12 LICENSE_AFL.txt
-rw-r--r--.  1 nobody root      10364 Jan 28 04:12 LICENSE.txt
-rw-r--r--.  1 nobody quick  35749362 Jan 29 18:29 Magento-CE-2.0.2-2016-01-28-02-26-45.tar.bz2
-rw-r--r--.  1 nobody root       4108 Jan 28 04:12 nginx.conf.sample
-rw-r--r--.  1 nobody root       1427 Jan 28 04:12 package.json
-rw-r--r--.  1 nobody root       1659 Jan 28 04:12 .php_cs
-rw-r--r--.  1 nobody root        804 Jan 28 04:12 php.ini.sample
drwxr-xr-x.  2 nobody root       4096 Jan 29 18:30 phpserver/
drwxr-xr-x.  6 nobody root       4096 Jan 29 18:30 pub/
-rw-r--r--.  1 nobody root       4388 Jan 28 04:10 README.md
drwxr-xr-x.  7 nobody root       4096 Jan 29 18:30 setup/
-rw-r--r--.  1 nobody root       3731 Jan 28 04:12 .travis.yml
drwxr-xr-x.  8 nobody root       4096 Jan 29 18:30 update/
drwxr-xr-x.  2 nobody root       4096 Jan 29 18:30 var/
drwxr-xr-x. 27 nobody root       4096 Jan 29 18:30 vendor/


    **ps -ef | grep httpd**
root     14165     1  0 11:43 ?        00:00:01 /usr/local/apache/bin/httpd -k start
nobody   18801 14165  0 18:35 ?        00:00:00 /usr/local/apache/bin/httpd -k start
nobody   18802 14165  0 18:35 ?        00:00:00 /usr/local/apache/bin/httpd -k start
nobody   18803 14165  0 18:35 ?        00:00:00 /usr/local/apache/bin/httpd -k start
nobody   18804 14165  0 18:35 ?        00:00:00 /usr/local/apache/bin/httpd -k start
nobody   18805 14165  0 18:35 ?        00:00:00 /usr/local/apache/bin/httpd -k start
root     18975 20796  0 18:43 pts/0    00:00:00 grep httpd
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • doushenyu2537 2016-01-29 18:04
    最佳回答

    You also probably need to chwon user:group bin/magento on the files you have installed (the magento files). You need to figure out which user Apache is running as and change user:group above to that, something like apache:apache or whatever is in your httpd.conf file.

    Post some more info (ls -al /path/to/magento and ps -ef | grep httpd for apache), but I'll bet that's your problem.

    Edit

    Based on your edited output, you need to chown the files to be owned by nobody, which is the user apache is running as. This can be done via chown -R nobody /path/to/magento

    Note that you only show the .bz2 archive, but you need to chown the extracted files.

    Also, you said you had to use the user that cpanel created when you installed it, so there you go.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题