VirtualHost for subdomain not working?

May 29, 2015 4.3k views
Apache WordPress Ubuntu


So I have successfully added a DNS record for my subdomain. Now I have access to ""

I then created a new virtualhost for my subdomain in /etc/apache2/site-availables/000-default.conf :

<VirtualHost *:80>

DocumentRoot /var/www/blog/
ErrorLog /var/log/httpd/blog/error.log

saved it and restarted apache.

But nothing changes... when I browse it still shows my main website. Obviously i have created a new folder ("blog") in /var/www and uploaded wordpress via FTP.

Am I missing something?

Thank you!

3 Answers

You need to create a new VirtualHost (new file)

```sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/domain.conf

```sudo nano /etc/apache2/sites-available/domain.conf




```    DocumentRoot /var/www/(foldername)

```sudo a2ensite domain.conf
sudo service apache2 restart

Here you go

I used another method but thank you for your time :) (it still doesn't fully work though since I get a blank page)


i followed the same method but it's not working for me

Have another answer? Share your knowledge.