Create Subdomain in Digitalocean

Hello friends today I teach you how to create subdomains in DigitalOcean

Note: You must watch the video before get started, You can follow the given commands step by step, If you have any doubts or any issues, Please comment your issue in comment section.

Create Subdomain in Digitalocean

Also read: How To Setup Multiple WordPress Sites on Digitalocean

#01 Step

sudo apt-get update

#02 Step

sudo mkdir -p /var/www/hi.example.com/public_html

#03 Step

sudo chown -R $USER:$USER /var/www/hi.example.com/public_html

#04 Step

sudo chmod -R 755 /var/www

#05 Step

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/hi.example.com.conf

#06 Step

sudo nano /etc/apache2/sites-available/hi.example.com.conf

#07 Step

<VirtualHost *:80>
        ServerAdmin info@example.com
        ServerName hi.example.com
        DocumentRoot /var/www/hi.example.com/public_html

        <Directory /var/www/hi.example.com/public_html/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

#08 Step

sudo a2ensite hi.example.com.conf

#08 Step

sudo service apache2 restart

If you have still any issues or doubts, Please comment below and Please share this article with your friends, Thank you!