user2763154 user2763154 - 8 months ago 25
Linux Question

Xubuntu Linux - Why doesn't my localhost direct me to my virtual host site?

I am setting up a virtual host on my linux machine, I followed all the steps and guides, but I do not go to my site for some reason. I have LAMP installed and apache, mysql, php is all working. I have a database setup on phpmyadmin and imported a database, but for some reason I cannot get my IP directed to my site! Its literally the last step I need so I can start working on my project. localhost

<VirtualHost *:80>
DocumentRoot /var/www/cbirc
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

What am I missing here???


You can be miles away not o n the last step :). You have to check bunch of stuff:

Is apache running

sudo service apache2 status

Afterwards, test it with

netstat -na | grep 80

Was website enabled by issuing following command?

sudo a2ensite cbirc 
file /etc/apache2/sites-enabled/cbirc.conf  (or some similar name it that folder)

Does www-data group and user has read-execute access on

ln -l /var/www/cbirc

If not, do it like this

sudo chown -R www-data:www-data /var/www/cbirc
sudo chmod -R ug+rx /var/www/cbirc

Before issuing request in browser, do it with curl or wget

curl -v

And look for error in logifile

tail -f /var/log/apache2/error.log

Please refer to my debian cheetsheat for further help