I have the following local services located in a server with IP 198.51.100.1:
127.0.0.1:5000 - special pda service
127.0.0.1:8888 - www service
I have configured the following DNS entries:
foo.com - A - 198.51.100.1
pda.foo.com - A - 198.51.100.1
www.foo.com - A - 198.51.100.1
The idea is that if user types pda.foo.com
site will proxy against 127.0.0.1:5000
via SSL
and that if user types www.foo.com
site will proxy against 127.0.0.1:8888
via SSL
.
I have the following config as the only sites-enabled
config file:
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>
This is shown when you do 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)
When I try to access www.foo.com I get site not found delivered by the DNS service provider.
When I try to access pda.foo.com it redirects to SSL but again I get site not found delivered by service provider.
Any tips?
0 Answers