我在 IP 为 198.51.100.1 的服务器上有以下本地服务:
127.0.0.1:5000 - special pda service
127.0.0.1:8888 - www service
我已经配置了以下 DNS 条目:
foo.com - A - 198.51.100.1
pda.foo.com - A - 198.51.100.1
www.foo.com - A - 198.51.100.1
这个想法是,如果用户输入site ,将通过viapda.foo.com
进行代理,如果用户输入site ,将通过via进行代理。127.0.0.1:5000
SSL
www.foo.com
127.0.0.1:8888
SSL
我有以下配置作为唯一的sites-enabled
配置文件:
NameVirtualHost *:80
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName pda.foo.com
Redirect permanent / https://pda.foo.com
</VirtualHost>
<VirtualHost *:80>
ServerName www.foo.com
Redirect permanent / https://www.foo.com
</VirtualHost>
</IfModule>
NameVirtualHost *:443
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName pda.foo.com
SSLProxyEngine On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/server2.foobar.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/server2.foobar.com/privkey.pem
</VirtualHost>
<VirtualHost *:443>
ServerName www.foo.com
SSLProxyEngine On
ProxyPass / http://127.0.0.1:8888/
ProxyPassReverse / http://127.0.0.1:8888/
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/server2.foobar.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/server2.foobar.com/privkey.pem
</VirtualHost>
</IfModule>
当您执行以下操作时会显示这一点apachectl -t -D DUMP_VHOSTS
:
AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabled/mysite.conf:1
VirtualHost configuration:
*:80 is a NameVirtualHost
default server pda.foo.com (/etc/apache2/sites-enabled/mysite.conf:4)
port 80 namevhost pda.foo.com (/etc/apache2/sites-enabled/mysite.conf:4)
port 80 namevhost www.foo.com (/etc/apache2/sites-enabled/mysite.conf:10)
*:443 is a NameVirtualHost
default server pda.foo.com (/etc/apache2/sites-enabled/mysite.conf:20)
port 443 namevhost pda.foo.com (/etc/apache2/sites-enabled/mysite.conf:20)
port 443 namevhost www.foo.com (/etc/apache2/sites-enabled/mysite.conf:47)
当我尝试访问 www.foo.com 时,DNS 服务提供商显示“未找到站点”。
当我尝试访问 pda.foo.com 时,它会重定向到 SSL,但我再次收到服务提供商提供的“未找到站点”信息。
有小费吗?