Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 禁止:你不';我没有权限访问此服务器上的/index.php_Apache_.htaccess - Fatal编程技术网

Apache 禁止:你不';我没有权限访问此服务器上的/index.php

Apache 禁止:你不';我没有权限访问此服务器上的/index.php,apache,.htaccess,Apache,.htaccess,我新安装了Apache/2.4.7(Ubuntu),运行一个LAMP堆栈。我已将所有文件传输到新服务器,在尝试访问子域时出现以下错误,实际域工作正常: Forbidden You don't have permission to access /index.php on this server. 我已经做了相当多的搜索,似乎有最多的解决方案(其中大部分我都尝试过) 这是我的apache2.conf文件: <Directory /> #Options FollowSymLin

我新安装了Apache/2.4.7(Ubuntu),运行一个LAMP堆栈。我已将所有文件传输到新服务器,在尝试访问子域时出现以下错误,实际域工作正常:

Forbidden You don't have permission to access /index.php on this server.
我已经做了相当多的搜索,似乎有最多的解决方案(其中大部分我都尝试过)

这是我的apache2.conf文件:

<Directory />
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>
请注意,我也在运行CodeIgniter(如果这很重要的话)

这是我加载的PHP模块(我想这里的某个地方有问题):


那么您的.htaccess文件呢,您是否有任何权限您可以完全访问服务器,但Apache使用的帐户是否具有访问权限?我认为这可能是解决方案@Sumurai8,我使用的是标准根帐户?-通常,Apache不是以root用户身份运行的,也不应该以root用户身份运行。我不能100%确定如何配置特定帐户的权限,但如果您需要帮助,这是一个适合ServerFault的问题。好的,澄清一下,Apache正在作为路由运行。我如何告诉Apache以另一个用户的身份运行?
RewriteEngine on
RewriteCond $1 !^(index\.php|images|js|profile_pictures|fonts|stylesheets|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

RewriteCond %{HTTP_HOST} !^((www\.)?)example\.com [NC] 
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com
RewriteRule ^(.*)$ http://example.com/site/%1$1 [L,NC,P]

RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
core mod_so mod_watchdog http_core mod_log_config mod_logio mod_version mod_unixd mod_access_compat mod_alias mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_host mod_authz_user mod_autoindex mod_deflate mod_dir mod_env mod_filter mod_mime prefork mod_negotiation mod_php5 mod_rewrite mod_setenvif mod_status