Question

Ok, so bit of noob question - having one of those days.

I have set up a home apache web server on Ubuntu. I have configured vhosts as I want to host multiple websites. These work fine in the local browser, e.g.

http://site1
http://site2

both display their various contents.

For the server side of things, I've configured port forwarding on my router to send all port 80 requests to the server IP.

When I go to an external browser and type in my servers external IP address I get the standard apache "It works!" message. When I type in ipaddress/site1 I get 404. The site1 is not in the standard apache default directory, I have it in home/username/Sites/site1 folder and httpd.conf file knows this.

How is it I can access these site1 and site2 sites externally?

Cheers

Était-ce utile?

La solution

Just as you would do in your local browser. So typing in http://site1 would lead you to the first site. This is based on an assumption though, which is that you put the http://site1 address in your /etc/hosts file. When your computer looks up an URL, it first checks the hosts file (and your case will find the correct IP address there) and next will ask a global mechanism for the address.

The reason why it doesnt find anything at "ipaddress/site1" is because of the vhosts configuration. This teel Apache serve the content of a folder somewhere on your server as a separate hostname, e.g. http://site1. If you're requesting "ipadress/site1", you're actually telling Apache to look in the folder "site1" in its first root it encounters in your Vhost configuration.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top