2

我已经安装了 apache xampp 并且都在内部工作。然后我将端口 8080 和路由器上的 IP 地址重定向到服务器的内部 IP 地址。我可以看到 nat 发生并且在服务器上我可以看到 httpd.exe 通过但无法从外部世界连接。

Listen 192.168.0.47:8080
ServerAdmin postmaster@192.168.0.47
ServerName 192.168.0.47:8080
DocumentRoot "/xampp/htdocs"
<Directory />
AllowOverride none
Require all granted
</Directory>
<Directory "/xampp/htdocs">

    Options Indexes FollowSymLinks Includes ExecCGI


    AllowOverride All


    Require all granted

</Directory>
<Files ".ht*">
    Require all denied
</Files>
container, that host's errors will be logged there and not here.
ErrorLog "logs/error.log"
CustomLog "logs/access.log" combined
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/xampp/cgi-bin/"
</IfModule>
<IfModule cgid_module>

</IfModule>
<Directory "/xampp/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>
4

2 回答 2

3
Listen 192.168.0.47:8080  

应该

Listen 0.0.0.0:8080

您只收听来自本地 IP 的请求

于 2013-05-30T11:07:35.167 回答
3

您需要更改以下三行:

Listen 192.168.0.47:8080
ServerAdmin postmaster@192.168.0.47
ServerName 192.168.0.47:8080

仅此:

Listen 8080

现在您的服务器只在监听连接192.168.0.47,外部连接将到达您的 ISP IP 地址。

ServerName除非使用URL连接,否则您不需要。这告诉服务器寻找一个 HTTP_HOST192.168.0.47以便您的 Apache 将拒绝对您的外部 IP 的请求。

于 2013-05-30T11:11:27.993 回答