我是apache的新用户,并尝试学习并设置了一个仅用于学习和测试的域。但是,在我开始之前,我正在获得Forbidden You do not have permission to access this document.
。经过研究,我知道此错误与http.conf
或.htaccess
文件有关。
我目录中没有.htaccess
个文件,并且发布了我的http.conf
文件。如果有人能帮助我克服这个问题,我将不胜感激。非常感谢
仅供参考我用前导零替换了敏感数据。
PHP:v5.4 fastcgi APACHE:Apache / 2.2.15(Unix)
以下是:ls -la
的结果total 468
dr-xr-x--- 5 root root 4096 Aug 10 2014 .
dr-xr-xr-x 26 root root 4096 Apr 3 12:19 ..
-rw------- 1 root root 1325 Jul 11 2011 anaconda-ks.cfg
drwxr-xr-x 2 root root 4096 Jan 23 03:49 .autoinstaller
-rw------- 1 root root 9454 Apr 3 12:18 .bash_history
-rw-r--r-- 1 root root 18 May 20 2009 .bash_logout
-rw-r--r-- 1 root root 176 May 20 2009 .bash_profile
-rw-r--r-- 1 root root 176 Sep 23 2004 .bashrc
-rw-r--r-- 1 root root 29 Aug 5 2014 created
-rw-r--r-- 1 root root 100 Sep 23 2004 .cshrc
-rw-r--r-- 1 root root 8730 Jul 11 2011 install.log
-rw-r--r-- 1 root root 3094 Jul 11 2011 install.log.syslog
-rw-r--r-- 1 root root 130324 Jan 8 2013 kmod-e1000e-2.1.4-1.el6.elrepo.x86_64.rpm
-rw-r--r-- 1 root root 135820 Sep 23 2013 kmod-e1000e-2.5.4-1.el6.elrepo.x86_64.rpm
-rw-r--r-- 1 root root 116252 Sep 23 2013 kmod-igb-5.0.5-1.el6.elrepo.x86_64.rpm
drwxr-xr-x 59 root root 4096 Apr 3 03:25 parallels
drwx------ 2 root root 4096 Aug 10 2014 .spamassassin
-rw-r--r-- 1 root root 129 Dec 3 2004 .tcshrc
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.
#IF YOU REQUIRE TO APPLY CUSTOM MODIFICATIONS, PERFORM THEM IN THE FOLLOWING FILES:
#/var/www/vhosts/system/domain.co.uk/conf/vhost.conf
<VirtualHost 00.00.00.00.:0000 >
ServerName "domain.co.uk:80"
ServerAlias "www.domain.co.uk"
ServerAlias "ipv4.domain.co.uk"
ServerAdmin "pa@domain.com"
UseCanonicalName Off
DocumentRoot "/var/www/vhosts/domain.co.uk/httpdocs"
CustomLog /var/www/vhosts/system/domain.co.uk/logs/access_log plesklog
ErrorLog "/var/www/vhosts/system/domain.co.uk/logs/error_log"
<IfModule mod_suexec.c>
SuexecUserGroup "peterc" "psacln"
</IfModule>
<IfModule mod_userdir.c>
UserDir "/var/www/vhosts/domain.co.uk/web_users"
</IfModule>
<IfModule mod_sysenv.c>
SetSysEnv PP_VHOST_ID "7d9a2c29-8013-470b-a6eb-36549a513f6b"
</IfModule>
ScriptAlias "/cgi-bin/" "/var/www/vhosts/domain.co.uk/httpdocs/cgi-bin/"
Alias "/plesk-stat" "/var/www/vhosts/system/domain.co.uk/statistics"
<Location /plesk-stat/>
Options +Indexes
</Location>
<Location /plesk-stat/logs/>
Require valid-user
</Location>
Alias /webstat /var/www/vhosts/system/domain.co.uk/statistics/webstat
Alias /webstat-ssl /var/www/vhosts/system/domain.co.uk/statistics/webstat-ssl
Alias /ftpstat /var/www/vhosts/system/domain.co.uk/statistics/ftpstat
Alias /anon_ftpstat /var/www/vhosts/system/domain.co.uk/statistics/anon_ftpstat
Alias /awstats-icon /var/www/html/awstats/icon
<IfModule mod_ssl.c>
SSLEngine off
</IfModule>
SetEnv PP_CUSTOM_PHP_INI /var/www/vhosts/system/domain.co.uk/etc/php.ini
SetEnv PP_CUSTOM_PHP_CGI_INDEX fastcgi
<IfModule mod_fcgid.c>
FcgidInitialEnv PP_CUSTOM_PHP_INI /var/www/vhosts/system/domain.co.uk/etc/php.ini
FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX fastcgi
FcgidMaxRequestLen 134217728
</IfModule>
<Directory /var/www/vhosts/domain.co.uk/httpdocs>
<IfModule mod_perl.c>
<Files ~ (\.pl$)>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options +ExecCGI
allow from all
PerlSendHeader On
</Files>
</IfModule>
<IfModule mod_python.c>
<Files ~ (\.py$)>
SetHandler python-program
PythonHandler mod_python.cgihandler
</Files>
</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.fcgi$)>
SetHandler fcgid-script
Options +ExecCGI
</Files>
</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.php$)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
Options +ExecCGI
</Files>
</IfModule>
Options -Includes +ExecCGI
</Directory>
<Directory "/var/www/vhosts/system/domain.co.uk/statistics">
AuthType Basic
AuthName "Domain statistics"
AuthUserFile "/var/www/vhosts/system/domain.co.uk/pd/d..httpdocs@plesk-stat"
require valid-user
</Directory>
Alias /error_docs /var/www/vhosts/domain.co.uk/error_docs
ErrorDocument 400 /error_docs/bad_request.html
ErrorDocument 401 /error_docs/unauthorized.html
ErrorDocument 403 /error_docs/forbidden.html
ErrorDocument 404 /error_docs/not_found.html
ErrorDocument 500 /error_docs/internal_server_error.html
ErrorDocument 405 /error_docs/method_not_allowed.html
ErrorDocument 406 /error_docs/not_acceptable.html
ErrorDocument 407 /error_docs/proxy_authentication_required.html
ErrorDocument 412 /error_docs/precondition_failed.html
ErrorDocument 414 /error_docs/request_uri_too_long.html
ErrorDocument 415 /error_docs/unsupported_media_type.html
ErrorDocument 501 /error_docs/not_implemented.html
ErrorDocument 502 /error_docs/bad_gateway.html
ErrorDocument 503 /error_docs/maintenance.html
<IfModule mod_security2.c>
</IfModule>
</VirtualHost>
答案 0 :(得分:1)
回应评论:
$ sudo chown -R apache:root /path/to/website
$ sudo find /path/to/website -type f -exec chmod 644 {} \;
$ sudo find /path/to/website -type d -exec chmod 755 {} \;
这将在您的网站根目录中递归(更改所有者)到apache:root(您可以更改为您的服务器用户)。然后它找到所有文件(-type f)并执行chmod 644并找到目录(-type d)并执行chmod 755 - 希望这会有所帮助:)