apache - 无法在apache中连接本地IP地址
问题描述
我无法让 apache 使用私有 IP。
我正在尝试绑定 172.2.1,何时尝试连接让我超时
httpd.conf
Listen 172.16.2.1:8080
<VirtualHost 172.16.2.1:8080>
ServerName 172.16.2.1
DocumentRoot /home/user/web/domain.com/public_html
ScriptAlias /cgi-bin/ /home/user/web/domain.com/cgi-bin/
Alias /error/ /home/user/web/domain.com/document_errors/
<Directory /home/user/web/domain.com/public_html>
AllowOverride All
Options +Includes -Indexes +ExecCGI
</Directory>
</VirtualHost>
查看端口是否打开
# netstat -plunt | grep :8080
tcp 0 0 172.16.2.1:8080 0.0.0.0:* LISTEN 5036/apache2
我可以ping通
ping -c3 172.16.2.1
PING 172.16.2.1 (172.16.2.1) 56(84) bytes of data.
64 bytes from 172.16.2.1: icmp_seq=1 ttl=64 time=0.062 ms
64 bytes from 172.16.2.1: icmp_seq=2 ttl=64 time=0.067 ms
64 bytes from 172.16.2.1: icmp_seq=3 ttl=64 time=0.063 ms
--- 172.16.2.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 57ms
rtt min/avg/max/mdev = 0.062/0.064/0.067/0.002 ms
我正在尝试访问同一台服务器
curl -I http://172.16.2.1:8080
curl: (7) Failed to connect to 172.16.2.1 port 8080: Connection timed out
我没有启用 iptables
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
我不知道可能出了什么问题。
解决方案
推荐阅读
- c++ - C++:C类没有命名类型(新场景)3个类
- python - CPython 扩展如何能够调用 CPython 内部定义的函数?
- python - Pandas 类别按类别排序
- php - 尝试使用 Chart.js 显示此图时,我的错误在哪里?
- python - 无法在 Mac (Python) 上导入 TA-Lib
- c# - 试图理解链表+类概念
- php - 从php中的数组中删除数字键
- python - 为什么代码在 python2 和 python3 中有不同的行为?
- mysql - SQL MAX 日期时间 - 1 天
- c# - 使用 SOAP 服务和 IIS 的 Windows 身份验证失败