I have two websites WebA
and WebB
. I am trying to serve both of these website in a single virtual machine with a single public IP using apache2 virtual hosting.
Before I write about the problem, here is my apache2 virtual hosting configuration:
WebA.conf:
<VirtualHost *:80>
ServerName weba.com
ServerAlias www.weba.com
Redirect permanent / https://weba.com
</VirtualHost>
<VirtualHost *:443>
ServerName weba.com
ServerAlias www.weba.com
ServerAdmin [email protected]
DocumentRoot /srv/apps/weba/weba
WSGIScriptAlias / "/srv/apps/weba/weba/weba/wsgi.py"
SSLEngine on
SSLCertificateFile /srv/certificate/weba.crt
SSLCertificateKeyFile /srv/certificate/weba.key
SSLCertificateChainFile /srv/certificate/webac.crt
ErrorLog /var/log/weba/error.log
CustomLog /var/log/weba/custom.log combined
<Directory /srv/apps/weba/>
AllowOverride None
Require all granted
</Directory>
<Directory /srv/apps/users/>
AllowOverride None
Require all granted
</Directory>
Alias /static /srv/apps/weba/weba/static
<Directory /srv/apps/weba/weba/static>
AllowOverride None
Require all granted
</Directory>
Alias "/weba/" "/srv/weba/"
<Directory "/srv/weba">
AllowOverride None
Require all granted
</Directory>
Alias "/contents/" "/srv/apps/"
<Directory "/srv/apps">
AllowOverride None
Require all granted
</Directory>
WSGIApplicationGroup %{GLOBAL}
</VirtualHost>
WebB.conf:
<VirtualHost *:80>
ServerName webb.com
ServerAlias www.webb.com
ServerAdmin [email protected]
DocumentRoot /srv/apps/webb/webb
WSGIScriptAlias / "/srv/apps/webb/webb/webb/wsgi.py"
ErrorLog /var/log/webb/error.log
CustomLog /var/log/webb/custom.log combined
<Directory /srv/apps/webb/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Alias /static /srv/apps/webb/webb/static
<Directory /srv/apps/webb/webb/static>
Require all granted
</Directory>
WSGIApplicationGroup %{GLOBAL}
</VirtualHost>
/etc/hosts:
127.0.0.1 localhost
127.0.1.1 localhost
127.0.0.1 weba.com webb.com
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Apache Version:
Problem:
The issue is that sometimes when I make a request to WebB, WebA is served, but after 3-5 page refreshes, WebB is served as requested. I've tried cleaning browser cache, using different devices, playing with the configs but couldn't find what the problem is. I also Looked at error logs to see if there is any issue, but couldn't find any.
Can anyone tell me why does these two web apps conflicts.