Apache: View Website
Wish everyone a happy, prosperous new year.
I have a question about viewing a website on Apache. Suppose you are running a test server on a public IP; say 100.100.100.100, running a couple of web sites. How can you access site1, site2 via a web browser from a different computer? I have tried http://100.100.100.100/site1, http://100.100.100.100:8080/site1 without any luck.
Seems that I am missing an obvious point.
Thanks for all the assistance.
Kindly have a look at the following URL, that will help you set up the virtual host
I assume you have not registered your websites. If you have, it should just be a matter of entering http://site1 in your browser's addrss bar and pressing <enter>.
If the websites are not registered:
Setup a couple of lines in /etc/hosts (for linux) on the machine where the browser runs; the location of the hosts file on a windows system is somewhere in a subdirectory (of a subdirectory ...) of the windows directory.
Explanation, if needed
When you enter http://site1 in you browser address bar and press <enter>, the first thing the browser does is attempt to translate the hostname (site1) to an ip-address; this is called 'resolving the hostname' and makes use of DNS servers (on the web or in your network) and the hosts file on the client machine. If the hostname can't be resolved, you will get something like 'server not found'. If it can be resolved, it will send a http request to the obtained ip-address. This http request will contain somewhere information about which site you want to visit (site1). Apache sees this when the request comes in and serves the correct page (if apache is configured correctly; read up on name based virtual hosts in the apache documentation of necessary).
By adding the two lines to the hosts file, you make that the name can be resolved and everything should work as expected. This assumes that the host file is part of the resolving which is, to my knowledge, usually the case.
@bijo505 I already have the virtual hosts running. Thank you very much for your answer.
@Wim Sturkenboom Thank you very much for your detailed explanation.
|All times are GMT -5. The time now is 04:10 AM.|