Thursday, July 14, 2016

Configure your .com website on Apache Server

If you want to run your website from an Apache2 server and make it available from yourdomain.com, you can follow these steps:

1) Go to /var/www/ and copy the root directory of yourproject (or clone the repository from Git).
2) Create a new file on /etc/apache2/sites-available/ named yourdomain.com.conf with this content:
    <VirtualHost *:80>
        DocumentRoot "/var/www/yourproject"
        ServerName www.yourdomain.com
        ServerAlias yourdomain.com
    </VirtualHost>
3) Activate the website with the command: sudo a2ensite yourdomain.com
4) Find your public IP with the command: sudo ifconfig (it should appear as innet_addr)
5) From your domain management site, edit the A DNS record for '@', pointing now to your public IP address
6) From your domain management site, edit the CNAME DNS record for 'www', pointing now too '@'
7) Wait a couple of hours until the DNS changes are propagated. Your website should be available from yourdomain.com and www.yourdomain.com.

No comments:

Post a Comment