home, PHP, updated

Setting Up Domain to Apache Ubuntu

To Resiter Domain on Apache Ubuntu.

1. sudo mkdir /var/www/your_domain
2. sudo chown -R $USER:$USER /var/www/your_domain
3. sudo chmod -R 755 /var/www/your_domain
4. sudo nano /var/www/your_domain/index.html
<html>
    <head>
        <title>Welcome to Your_domain!</title>
    </head>
    <body>
        <h1>Success!  The your_domain virtual host is working!</h1>
    </body>
</html>

5. sudo nano /etc/apache2/sites-available/your_domain.conf
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName your_domain
    ServerAlias www.your_domain
    DocumentRoot /var/www/your_domain
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


6. sudo a2ensite your_domain.conf
7. sudo a2dissite 000-default.conf
8. sudo apache2ctl configtest
Output
Syntax OK

9. sudo systemctl restart apache2
10. http://your_domain

Related Articles

post a comment