# SSL VirtualHost — WSGI lives HERE only (avoid duplicate daemon name).
# Paths assume Let's Encrypt files already issued for melhorprecoro.com.br.
#
#   sudo cp deploy/apache-melhorprecoro-le-ssl.conf.example \
#     /etc/apache2/sites-available/melhorprecoro.com.br-le-ssl.conf
#   sudo a2ensite melhorprecoro.com.br-le-ssl
#   sudo apache2ctl configtest && sudo systemctl reload apache2
#
# SITE_UF=RO is required: without it this checkout would load the DF env.

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName melhorprecoro.com.br
    ServerAlias www.melhorprecoro.com.br

    DocumentRoot /var/www/html/melhorprecoro.com.br

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/melhorprecoro.com.br/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/melhorprecoro.com.br/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf

    WSGIDaemonProcess melhorprecoro \
        python-home=/var/www/html/melhorprecoro.com.br/venv_3_12 \
        python-path=/var/www/html/melhorprecoro.com.br \
        user=www-data group=www-data \
        processes=2 threads=15 \
        display-name=%{GROUP} \
        lang='en_US.UTF-8' locale='en_US.UTF-8' \
        env='SITE_UF=RO,DJANGO_ENV_FILE=/etc/melhorprecoro/django.env,DATA_DIR=/var/www/html/melhorprecoro.com.br'

    WSGIProcessGroup melhorprecoro
    WSGIScriptAlias / /var/www/html/melhorprecoro.com.br/core/wsgi.py
    WSGIPassAuthorization On

    <Directory /var/www/html/melhorprecoro.com.br/core>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    Alias /static/ /var/www/html/melhorprecoro.com.br/staticfiles/
    <Directory /var/www/html/melhorprecoro.com.br/staticfiles>
        Require all granted
    </Directory>

    <Directory /var/www/html/melhorprecoro.com.br>
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/melhorprecoro-ssl-error.log
    CustomLog ${APACHE_LOG_DIR}/melhorprecoro-ssl-access.log combined
</VirtualHost>
</IfModule>
