Search code examples
htmllinuxwebserver

How to setup a subdomain in a site's server?


I have a domain name , hacks4liveprojects.com , but I want to make a subdomain; somethinghere.hacks4liveprojects.com or something like that. My site is hosted on an Ubuntu 17.10 Server.

How to do this?

My site is in : /var/www/html/ if you wanted to know...

Edit : grammar


Solution

    • Make a directory in your /var/www/html named somethinghere
    • Go to /etc/apache2/sites-available
    • Copy the 000-default.conf to somethinghere.conf
    • edit somethinghere.conf
    • change the ServerName to somethinghere.hacks4liveprojects.com and Directory /var/www/html to Directory /var/www/html/somethinghere. The same goes for DocumentRoot
    • Then activate it with sudo a2ensite somethinghere.conf and reload your apache settings with sudo service apache2 reload