'Apache - Hosting two Django projects issue - One project is very slow / unaccessible
I'm hosting two Django projects on my Ubuntu 20.04 server using Apache, with two different domains.
djangoproject1 is hosted on example1.com:8000
djangoproject2 is hosted on example2.com:8000
However I'm having a strange issue where only one of the two is accessible at a time. Both sites work perfectly when the other one is disabled (using "a2dissite"). But when both are enabled, only one will work and the other one loads forever until time out.
djangoproject1.conf
<VirtualHost *:8000>
ServerAdmin webmaster@localhost
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/djangoproject1
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /var/www/djangoproject1/static
<Directory /var/www/djangoproject1/static>
Require all granted
</Directory>
Alias /static /var/www/djangoproject1/media
<Directory /var/www/djangoproject1/media>
Require all granted
</Directory>
<Directory /var/www/djangoproject1/project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess djangoproject1 python-home=/var/www/djangoproject1/venv python-path=/var/www/djangoproject1
WSGIProcessGroup djangoproject1
WSGIScriptAlias / /var/www/djangoproject1/project/wsgi.py
</VirtualHost>
djangoproject2.conf (similar to djangoproject1.conf)
<VirtualHost *:8000>
ServerAdmin webmaster@localhost
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/djangoproject2
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /var/www/djangoproject2/static
<Directory /var/www/djangoproject2/static>
Require all granted
</Directory>
Alias /static /var/www/djangoproject2/media
<Directory /var/www/djangoproject2/media>
Require all granted
</Directory>
<Directory /var/www/djangoproject2/project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess djangoproject2 python-home=/var/www/djangoproject2/venv python-path=/var/www/djangoproject2
WSGIProcessGroup djangoproject2
WSGIScriptAlias / /var/www/djangoproject2/project/wsgi.py
</VirtualHost>
The apache logs shows the following error multiple times:
(11)Resource temporarily unavailable: mod_wsgi (pid=1498191): Couldn't create worker thread 6 in daemon process 'djangoproject2'.
I would highly appreciate some help with this issue as I have no idea what's causing it and I can't find any solutions to this problem. Any suggestions or advice is welcome.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
