我在端口80上的Google Compute Engine节点和端口81上的Apache httpd上运行。但是当我尝试通过URL访问端口81时,即IP地址,XX.XXX.XXX.XXX:81,浏览器将请求重定向到80,即节点应用程序。我怎样才能使它发挥作用?
ports.conf
Listen 81
/ 000-default.conf启用位点-
<VirtualHost *:81>
....
</VirtualHost>
我错过了什么?谢谢。
部署Node应用程序时,我运行了以下命令:
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000
netstat -l </ p>
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:mysql 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:81 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 [::]:3000 [::]:* LISTEN
udp 0 0 instance.c:ntp 0.0.0.0:*
udp 0 0 localhost:ntp 0.0.0.0:*
udp 0 0 0.0.0.0:ntp 0.0.0.0:*
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
udp6 0 0 localhost:ntp [::]:*
udp6 0 0 [::]:ntp [::]:*
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] SEQPACKET LISTENING 8972 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 12342 /var/run/mysqld/mysqld.sock
unix 2 [ ACC ] STREAM LISTENING 9021 /run/systemd/fsck.progress
unix 2 [ ACC ] STREAM LISTENING 27705 /home/myuser/.forever/sock/worker.1508373192880gMA.sock
unix 2 [ ACC ] STREAM LISTENING 10413 /run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 8907 /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 8928 /run/systemd/journal/stdout
unix 2 [ ACC ] STREAM LISTENING 10225 /run/uuidd/request