您无权访问此服务器上的/!错误

时间:2017-08-31 21:26:19

标签: debian apache2

我安装了64位64位Debian 7.11。我试了很长时间让这台服务器工作。我可以在我的服务器上完全正常访问该网页,但我的朋友和我的手机无法访问其设备上的网页。我试过更改apache2的“默认”配置文件,但没有运气。有什么建议吗?

**<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride all
    Order deny,allow
    allow from all
    Require all granted
</Directory>
<Directory /var/www/>
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride all
    Order allow,deny
    allow from all
    Require all granted
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride none
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

**

如果您需要更多信息,我可以提供。

编辑:

<VirtualHost *:80>
ServerAdmin webmaster@localhost

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

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

现在我已将代码更改为此,但仍无法正常工作...

1 个答案:

答案 0 :(得分:0)

我通过在 httpd.conf 的全局目录设置或 httpd-中的特定目录块中设置选项指令来解决同样的问题。 vhosts.conf

Options Indexes FollowSymLinks Includes ExecCGI

默认情况下,您的全局目录设置为(httpd.conf line ~188)

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>

将选项设置为: Options Indexes FollowSymLinks Includes ExecCGI

最后,它应该看起来像:

<Directory />
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>

同时尝试按Order deny,allow更改Allow from allRequire all granted行。