在 Ubuntu 上访问端口 8080 上的 http 服务器
netstat -tulpn 输出:
Connexions Internet actives (seulement serveurs)
Proto Recv-Q Send-Q Adresse locale Adresse distante Etat PID/Program name
tcp 0 0 0.0.0.0:13000 0.0.0.0:* LISTEN 1941/bearerbox
tcp 0 0 0.0.0.0:13001 0.0.0.0:* LISTEN 1941/bearerbox
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1141/mysqld
tcp 0 0 0.0.0.0:13131 0.0.0.0:* LISTEN 1994/smsbox
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 2844/vino-server
tcp 0 0 127.0.0.1:5941 0.0.0.0:* LISTEN 2200/teamviewerd
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN 1616/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1065/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3149/cupsd
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 1227/postgres
tcp6 0 0 :::5800 :::* LISTEN 2844/vino-server
tcp6 0 0 :::5900 :::* LISTEN 2844/vino-server
**tcp6 0 0 :::8080 :::* LISTEN 7062/apache2**
tcp6 0 0 :::80 :::* LISTEN 7062/apache2
tcp6 0 0 :::22 :::* LISTEN 1065/sshd
tcp6 0 0 ::1:631 :::* LISTEN 3149/cupsd
udp 0 0 0.0.0.0:631 0.0.0.0:* 1117/cups-browsed
udp 0 0 0.0.0.0:43858 0.0.0.0:* 785/avahi-daemon: r
udp 0 0 0.0.0.0:5353 0.0.0.0:* 785/avahi-daemon: r
udp 0 0 0.0.0.0:42579 0.0.0.0:* 1204/dhclient
udp 0 0 127.0.1.1:53 0.0.0.0:* 1616/dnsmasq
udp 0 0 0.0.0.0:68 0.0.0.0:* 1204/dhclient
udp6 0 0 :::5353 :::* 785/avahi-daemon: r
udp6 0 0 :::52679 :::* 785/avahi-daemon: r
udp6 0 0 :::3779 :::* 1204/dhclient
网络地图:我的 WAN IP 地址是41.125.130.148
:
nmap 41.125.130.148
Starting Nmap 6.40 ( http://nmap.org ) at 2014-06-14 19:32 CET
Nmap scan report for 41.125.130.148
Host is up (0.0012s latency).
Not shown: 996 closed ports
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
23/tcp open telnet
80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 20.30 seconds
我的 Apache 配置/etc/apache2
:
cat /etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf
Listen 80
Listen 8080
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
vim: syntax=apache ts=4 sw=4 sts=4 sr noet
我测试访问localhost:8080/html/playsms
是可以的,但是125.130.148:8080/html/playsms
打开和关闭
答案1
这个 IP 是什么125.130.148
?您声明您的 WAN IP 是41.125.130.148
,因此您应该检查 WAN IP 和/或 LAN IP,但您可能会碰到 DSL 调制解调器 - 路由器的 NAT 环回。
绕过 NAT 环回的一个可能解决方案是设置指向本地域的本地 DNS。
此外,您还应检查您的站点配置和/etc/apache2/sites-available
/etc/apache2/sites-enabled`,您在那里启用了哪些 IP - 域名和端口?
虚拟主机监听的示例任何IP - 端口上的域名80:
<VirtualHost *:80>
ServerName foobar.com # this is your domain name
ServerAlias www.foobar.com # an alias using www prefix
DocumentRoot /srv/www/foobar.com/public_html # where your puclic documents (HTML) lives
ErrorLog /var/log/foobar.com/apache2/foobar_error.log # error logs for the domain
CustomLog /var/log/foobar/apache2/foobar_access.log # access logs for the domain
</VirtualHost>