1

Following this answer I used the following conf in my virtual host for certbot to install certificate as WSGIProcessGroup duplicate error showed. But after certbot successful installation, my directory was open to browsing with the index of at the top.

What is wrong with the conf?

WSGIApplicationGroup %{GLOBAL}
<VirtualHost *:80>

        ServerAdmin name@example.com
        ServerName myproject.example.com
        DocumentRoot /var/www/myproject.example.com/myproject/

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <Directory /var/www/myproject.example.com/myproject/myproject>
            <Files wsgi.py>
                Require all granted
            </Files>
        </Directory>

        Alias /static /var/www/myproject.example.com/myproject/static
        <Directory /var/www/myproject.example.com/myproject/static>
            Require all granted
        </Directory>
        
        WSGIDaemonProcess myproject python-home=/var/www/myproject.example.com/venv python-path=/var/www/myproject.example.com/myproject
        WSGIProcessGroup myproject
        WSGIScriptAlias / /var/www/myproject.example.com/myproject/myproject/wsgi.py

RewriteEngine on
RewriteCond %{SERVER_NAME} =myproject.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>

        ServerAdmin name@example.com
        ServerName myproject.example.com
        DocumentRoot /var/www/myproject.example.com/myproject/

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <Directory /var/www/myproject.example.com/myproject/myproject>
            <Files wsgi.py>
                Require all granted
            </Files>
        </Directory>

        Alias /static /var/www/myproject.example.com/myproject/static
        <Directory /var/www/myproject.example.com/myproject/static>
            Require all granted
        </Directory>

        WSGIProcessGroup myproject

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/myproject.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/myproject.example.com/privkey.pem
</VirtualHost>
Riden Shark
  • 41
  • 1
  • 8

0 Answers0