I'm trying to move for the first time a website to a dedicated server running on debian. I created a file called mywebsite.com.conf in /etc/apache2/sites-available
Here's the file :
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName mywebsite.com
ServerAlias www.mywebsite.com
DocumentRoot /var/www/html/mywebsite.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/mywebsite.com/public_html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
At first I also added a *:80 entry, but it didn't please certbot for some reason so I deleted it. I then asked certbot to establish a certificate using this command :
sudo certbot --apache -d mywebsite.com -d www.mywebsite.com
Everything went fine, I asked an automatic redirection and certbot created two more files in the sites-available directory.
But when I try to access my website, it shows the index.html I created at /var/www/html instead of the full path to my website. Also the connection isn't secured.
I tried many things with my friend chatgpt, the best I managed to do was a secured connection that pointed to /var/www/html through https://mywebsite.com and a non secured connection that pointed to /var/www/html/mywebsite.com/public_html for some reason, through www.mywebsite.com
I'm running out of solutions here. It seems that my conf files are not doing their jobs.
If someone can enlight me with a possible outcome.
Thanks a lot.
/etc/apache2/sites-enabled
directing to your configs (which you wanna load) in/etc/apache2/sites-available
.