I have configured Apache 24 with mod_wsgi on windows 2016 server for my Django applications and deployed three websites with different IP addresses. I have also configured ssl certificates for each domain and everything is working fine until somehow the system shuts-down due to power and when the system is back Apache returns only "It works" for all domains unless I restart the Apache service manually. why is this happening please help. I have to restart Apache server every time I lose power.
I have also placed ssl files for one domain inside conf folder named server.crt,server.ca-bundle and server.key
below is my virtual host configuration
LoadFile "C:/<virtual environment directory>/Scripts/python38.dll"
LoadModule wsgi_module "c:/<virtual environment directory>/lib/site-packages/mod_wsgi/server/mod_wsgi.cp38-win_amd64.pyd"
WSGIPythonHome "C:/<python installation directory>/python38"
WSGIPythonPath "C:/<virtual environment directory>/Lib/site-packages"
NameVirtualHost domain1.com:80
<VirtualHost domain1.com:80>
ServerAlias www.domain1.com
ServerName domain1.com
Redirect permanent / https://domain1.com
</VirtualHost>
<VirtualHost domain1.com:443>
ServerAlias www.domain1.com
ServerName domain1.com
ServerAdmin [email protected]
SSLEngine On
SSLCertificateFile "C:/<SSL certificate direcory>/<cirtificate-name>.crt"
SSLCertificateChainFile "C:/<SSL certificate direcory>/<cirtificate-name>.ca-bundle"
SSLCertificateKeyFile "C:/<SSL certificate direcory>/<cirtificate-name>.key"
Alias /static/ "C:/<project root directory>/static/"
<Directory "C:/<project root directory>/static">
Require all granted
</Directory>
Alias /media/ "C:/<project root directory>/media/"
<Directory "C:/<project root directory>/media">
Require all granted
</Directory>
WSGIScriptAlias / "C:/<project root directory>/fbpidi_portal/<wsgi file name>.py"
<Directory "C:/<project root directory>/fbpidi_portal">
<Files <wsgi file name>.py>
Require all granted
</Files>
</Directory>
ErrorLog "C:/<project root directory>/logs/apache.error.log"
CustomLog "C:/<project root directory>/logs/apache.custom.log" common
</VirtualHost>
NameVirtualHost domain2.com:80
<VirtualHost domain2.com:80>
ServerAlias www.domain2.com
ServerName domain2.com
Redirect permanent / https://domain2.com
</VirtualHost>
<VirtualHost domain2.com:443>
ServerAlias www.domain2.com
ServerName domain2.com
ServerAdmin [email protected]
SSLEngine On
SSLCertificateFile "C:/<SSL certificate directory>/<certificate-name>.crt"
SSLCertificateChainFile "C:/<SSL certificate directory>/<certificate-name>.ca-bundle"
SSLCertificateKeyFile "C:/<SSL certificate directory>/<certificate-name>.key"
Alias /static/ "C:/<project root directory>/static/"
<Directory "C:/<project root directory>/static">
Require all granted
</Directory>
Alias /media/ "C:/<project root directory>/media/"
<Directory "C:/<project root directory>/media">
Require all granted
</Directory>
WSGIScriptAlias / "C:/<project root directory>/<project name>/wsgi.py"
<Directory "C:/<project root directory>/<project name>">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
ErrorLog "C:/<project root directory>/logs/apache.error.log"
CustomLog "C:/<project root directory>/logs/apache.custom.log" common
</VirtualHost>
Listen 8080
<VirtualHost 0.0.0.0:8080>
ServerAlias 0.0.0.0
ServerName 0.0.0.0
ServerAdmin [email protected]
Alias /static/ "C:/<project root path>/static/"
<Directory "C:/<project root path>/static">
Require all granted
</Directory>
Alias /media/ "C:/<project root path>/media/"
<Directory "C:/<project root path>/media">
Require all granted
</Directory>
WSGIScriptAlias / "C:/<project root path>/<app name>/wsgi.py"
<Directory "C:/<project root path>/<app name>">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
ErrorLog "C:/<project root path>/logs/apache.error.log"
CustomLog "C:/<project root path>/logs/apache.custom.log" common
</VirtualHost>