I'm trying to setup my application using HTTPs, I followed a guide HERE to do it properly but it's not working.
My app runs perfectly in port 80 (http) and when I turn on auto redirect for 443 (https) it gives me a 403 forbiddend when I try to access it through Browser. And in Apache2 error log, I can see the message "AH01276: Cannot serve directory /var/my_app_location/: No matching DirectoryIndex"
The differences between conf files from 80 to 443 are basically:
Port number
Present in 443 file config:
- "IfModule mod_ssl.c" present in 443 file config
- Include letsencrypt
- SSLCertificateFile
- SSLCertificateKeyFile
- <Directory "/var/my_app_location/">AllowOverride none Require all granted
Can anyone guide me?
UPDATE Here is the virtualhost files:
<VirtualHost *:80> ServerAdmin [email protected] ServerName mydomain.com.br ServerAlias www.mydomain.com.br DocumentRoot /var/netcore/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined RewriteEngine off RewriteCond %{SERVER_NAME} =www.mydomain.com.br [OR] RewriteCond %{SERVER_NAME} =mydomain.com.br RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI}[END,NE,R=permanent] </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin [email protected] ServerName www.mydomain.com.br ServerAlias *.mydomain.com.br DocumentRoot /var/netcore/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined <Directory "/var/netcore"> AllowOverride none Require all granted </Directory> Include /etc/letsencrypt/options-ssl-apache.conf SSLCertificateFile /etc/letsencrypt/live/mydomain.com.br/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.com.br/privkey.pem </VirtualHost> </IfModule>
I followed a guideeither the guide is broken, or you didn't follow it correctly