0

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.

New contributor
Mathias Paicheler is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
3
  • Is mod_ssl enabled? 12 hours ago
  • You need to create a symlink within the directory /etc/apache2/sites-enabled directing to your configs (which you wanna load) in /etc/apache2/sites-available.
    – paladin
    12 hours ago
  • Ok thank you it was an issue with the sites-enabled. I removed old 000-default and default-ssl from sites-available and forgot to run a2dissite for them. Now it's perfectly working ! Thanks for the fast help. 12 hours ago

0

You must log in to answer this question.

Browse other questions tagged .