Apache2 Configuration is rather straight forward. if you have not yet pointed the DNS record from for example GoDaddy’s DNSMANAGER or some other service paid or free you must do that in order for your site to work with FQDN (Fully Qualified Domain Name).
sudo vi /etc/apache2/sites-available/default
This is what the default website configuration file looks like.
Nothing to edit in this screenshot, so go down to the next step!
I recommend copying the “default” file and working on other so you always have a clean template to work with and then the DNS will only resolve the domain name and not the public IP address of the server alone.
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mywebsite
sudo vi /etc/apache2/sites-available/mywebsite
You want to Edit ServerAdmin, ServerName, ServerAlias & DocumentRoot to match your details.
We will now enable the site with a2ensite
sudo a2ensite mywebsite
Restart the networking ensure the website is functioning properly!
sudo /etc/init.d/apache2 restart
Now try browsing to your website!
- Many problems I see when people attempt this is when they do not have port forwarding on their router, or their ISP does not allow web hosting! Check for those before troubleshooting anything else.