问题原文
原帖链接 · Tibor Nagy · CC BY-SA 4.0
I have a host (Ubuntu 16.04) and a virtual machine on it. I want to use apache to forward different ports to the VM with the reverse proxy modul. The problem is, that apache doesn't listen on all configured ports.
I have the following settings in /etc/apache2/sites-enabled/moni1.softxs.ch:
<VirtualHost *:80>
ServerName moni1.softxs.ch
Redirect 301 / https://moni1.softxs.ch/
</VirtualHost>
<VirtualHost *:443>
ServerName moni1.softxs.ch
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://172.16.3.101:80/ retry=0
ProxyPassReverse / http://172.16.3.101/
SSLCertificateFile /etc/letsencrypt/live/moni1.softxs.ch/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/moni1.softxs.ch/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/moni1.softxs.ch/chain.pem
</VirtualHost>
<VirtualHost *:3000>
ServerName moni1.softxs.ch
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://172.16.3.101:3000/ retry=0
ProxyPassReverse / http://172.16.3.101/
</VirtualHost>
<VirtualHost *:3010>
ServerName moni1.softxs.ch
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://172.16.3.101:3010/ retry=0
ProxyPassReverse / http://172.16.3.101/
</VirtualHost>
I can see with netstat, that apache doesn't listen on port 3010. No idea, why.
$ netstat -nlptu | grep apache2
tcp6 0 0 :::80 :::* LISTEN 32252/apache2
tcp6 0 0 :::3000 :::* LISTEN 32252/apache2
tcp6 0 0 :::443 :::* LISTEN 32252/apache2
The port is free, I can listen on it with nc. All other reverse proxy setting are working as expected.
已采纳解答
原帖链接 · Michael Hampton · CC BY-SA 4.0
Somewhere in your Apache configuration, you must have matching Listen directives for each port you want to listen to:
Listen 3000
Listen 3010
It appears that you already have one, but not the other.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
