设置WAMP服务器 - 获得403

时间:2013-09-23 20:38:34

标签: apache wamp apache-config

我想把我的网站放到网上。我正在使用WampServer 2.2。现在,我已经设置如下:

<Directory />
  AllowOverride All
  Options All
  Require all granted
  Order allow,deny
</Directory>

Listen 81
<VirtualHost *:81>
  ServerName rti.etf.rs
  DocumentRoot "C:/wamp/www"
  DirectoryIndex index.php
</VirtualHost>

我在Windows防火墙中打开了端口81。现在,当我尝试打开localhost:81时,我的网页打开很好。但是,当我尝试使用外部IP地址176.xxx.xxx.xxx:81访问它时,我收到403 Forbidden错误。我在Apache访问日志中看到了这些请求,所以我想这部分设置得很好,但我必须遗漏一些Apache配置。

编辑:启用在线选项。

有用的想法吗?

1 个答案:

答案 0 :(得分:1)

好的,试试这个,你没有指定你使用的是哪个版本的Apache,而且你似乎将Apache 2.2语法与Apache 2.4语法混合在一起,所以我给出了两个版本。

将此部分更改回原来的状态,这可以控制对C:\的访问权限,并且您只允许完全访问它,而不是很好。

<Directory />
  AllowOverride All
  Options All
  Require all granted
  Order allow,deny
</Directory>

要 Apache 2.2.x语法

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order Deny,Allow
    Deny from all
</Directory>

Apache2.4.x语法

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>




现在到您的虚拟主机。这也需要在块

中指定它自己的安全性
Listen 81
<VirtualHost *:81>
  ServerName rti.etf.rs
  DocumentRoot "C:/wamp/www"
  DirectoryIndex index.php
#### Apache 2.2 syntax
  <Directory "C:/wamp/www/">
     AllowOverride All
     Order Allow,Deny
     Allow from all
  </Directory>
#### Apache 2.4 syntax
  <Directory "C:/wamp/www/">
     AllowOverride All
     Require all granted
  </Directory>
</VirtualHost>

PS。 我看不到使用端口81的任何好处,它只会让外部用户的生活更加复杂。