I have a WSGI app working in prod and I want a staging app in the same server, So I configured two virtual hosts in different ports, 80 for prod and 9090 for stag, but every time I request port 9090 it is using the prod app and I dont know why. Here is my configuration:
prod.conf:
LoadModule wsgi_module modules/mod_wsgi.so
NameVirtualHost *:80
ServerName dashboard
<VirtualHost *:80>
ServerName dashboard
WSGIDaemonProcess dashboard display-name=%{GROUP}
WSGIProcessGroup dashboard
WSGIScriptAlias / /srv/dashboard/wsgi.py process-group=dashboard application-group=dashboard
WSGIPassAuthorization on
Alias /static/ /srv/dashboard/static/
Alias /favicon.ico /srv/dashboard/static/favicon.ico
DocumentRoot "/srv/dashboard"
<Directory /srv/dashboard>
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride None
Require all granted
</Directory>
<Directory /srv/dashboard/static>
Options +Indexes +FollowSymLinks +MultiViews
Require all granted
</Directory>
ErrorLog "/var/log/httpd/dashboard-error.log"
CustomLog "/var/log/httpd/dashboard-access.log" common
</VirtualHost>
stag.conf:
LoadModule wsgi_module modules/mod_wsgi.so
Listen 9090
NameVirtualHost *:9090
ServerName dashboard-stagging
<VirtualHost *:9090>
ServerName dashboard-stagging
WSGIDaemonProcess dashboard-stagging display-name=%{GROUP}
WSGIProcessGroup dashboard-stagging
WSGIScriptAlias / /srv/dashboard-stagging/wsgi.py process-group=dashboard-stagging application-group=pnpdash$
WSGIPassAuthorization on
Alias /static/ /srv/dashboard-stagging/static/
Alias /favicon.ico /srv/dashboard-stagging/static/favicon.ico
DocumentRoot "/srv/dashboard-stagging"
<Directory /srv/dashboard-stagging>
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride None
Require all granted
</Directory>
<Directory /srv/dashboard-stagging/static>
Options +Indexes +FollowSymLinks +MultiViews
Require all granted
</Directory>
ErrorLog "/var/log/httpd/dashboard-stag-error.log"
CustomLog "/var/log/httpd/dashboard-stag-access.log" common
</VirtualHost>
My /var/log/httpd/dashboard-stag-access.log keeps empty when I request http://dashboard.mycompany.com:9090 and it uses the app in port 80.
Any guidance?
Best Answer
Check the cookie names of your apps called by wsgi (prod and stag), they must not conflict. Example: I have 2 apps with flask and wsgi, using the same program with different parameters. I have to assign different values to config["SESSION_COOKIE_NAME"] to avoid conflicts.