I want to run multiple Django project on Apache2 server. So if I type in my url:
localhost/OpenGMS
my OpenGMS
project would run in the apache2 server and if I type in the url:
localhost/my_other_site
my other project will run in the apache2 server.
To do this I configured the /etc/apache2/sites-available/000-default.conf
. It looks like this :
<VirtualHost *:80>
ServerName OpenGMS.org
ServerAlias www.OpenGMS.org
ServerAdmin samsadsajid@gmail.com
DocumentRoot /var/www/OpenGMS
WSGIScriptAlias / /var/www/OpenGMS/OpenGMS/wsgi.py
ErrorLog /var/www/logs/error.log
CustomLog /var/www/logs/custom.log combined
</VirtualHost>
And also configured /etc/apache2/apache2.conf
. I added a single line at the end of the file. The line is
WSGIPythonPath /var/www/OpenGMS
I find a question related to this here. It says that
An alternative which involves a bit more work, but can have other benefits, is to switch to using daemon mode of mod_wsgi to run the Django instances and delegate each to a separate set of processes. By running the Django instances in separate processes there can be no possibility of environment variables leaking from one to the other.
WSGIDaemonProcess project-2 WSGIScriptAlias /suburl
> /some/path/project-2/wsgi.py process-group=project-2
WSGIDaemonProcess project-1 WSGIScriptAlias /
> /some/path/project-1/wsgi.py process-group=project-1
Then I configured the /etc/apache2/sites-available/000-default.conf
again. It looked like this:
<VirtualHost *:80>
ServerName OpenGMS.org
ServerAlias www.OpenGMS.org
ServerAdmin samsadsajid@gmail.com
DocumentRoot /var/www/OpenGMS
WSGIDaemonProcess my_other_site
WSGIScriptAlias /my_other_site /var/www/my_other_site/my_other_site/wsgi.py process-group=my_other_site
WSGIDaemonProcess OpenGMS
WSGIScriptAlias / /var/www/OpenGMS/OpenGMS/wsgi.py process-group=OpenGMS
ErrorLog /var/www/logs/error.log
CustomLog /var/www/logs/custom.log combined
</VirtualHost>
But I didn't configure the /etc/apache2/apache2.conf
file.
Now when I run the localhost/OpenGMS
or/and localhost/my_other_site
I get internal server error 500.
Is the error happening because I didn't edit the /etc/apache2/apache2.conf
after adding a new site in the /etc/apache2/sites-available/000-default.conf
or there are some other things I am doing wrong or don't know?