How do I set up a virtual host?

5

My router redirects port 80 to port 8080. My router works fine and my domain name is routed properly.

This is my virtual hosts file:

NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot /home/admins/lampstack-5.3.16-0/apps/wordpress
    ServerName example.com
    ServerAlias www.example.com
</VirtualHost>

I can access my website by entering "mywebsite.com:8080" but I cannot access it by entering "mywebsite.com"

For further information, this is a part of my httpd.conf:

Listen 8080
Servername localhost:8080
DocumentRoot "/home/admins/lampstack-5.3.16-0/apache2/htdocs
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny, allow
    deny from all
</Directory>
<Directory "/home/admins/lampstack-5.3.16-0/apache2/htdocs">
    Options FollowSymLinks
    AllowOverride None
    Order allow, deny
    allow from all
</Directory>

SOLUTION:

Background info: I installed ubuntu 10.4, then I installed bitnami lamp stack, then I installed a wordpress module. Basically if you install wordpress as just a user (not root) then you can't use port 80 (you can't listen to port 80 in the httpd.conf (/apache2/conf/httpd.conf)). What I had to do is reinstall both lampstack and wordpress as root.

I enabled root by doing the following: http://www.liberiangeek.net/2012/05/login-as-root-in-ubuntu-12-04-precise-pangolin/

You should also have a look at nat redirection, it could be a reason as to why you are having problems

After I did all of that, Everything started working on port 80, but I still couldn't access my website from my external ip or from another computer on my network. My router randomly restarted and fixed that though. so I'm not sure about that.

piratepartypumpkin

Posted 2012-09-25T21:23:16.127

Reputation: 63

You shouldn't include your solution in your Question. You should create a new Answer with that information and "accept" it. – ale – 2012-09-27T13:51:54.720

Answers

2

Yes, because you have told your server not to listen on port 80

add to your configuration the following:

Listen 80

Everything should be OK

Serge

Posted 2012-09-25T21:23:16.127

Reputation: 2 585