LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 12-31-2012, 01:55 AM   #1
chief_officer
Member
 
Registered: Mar 2006
Location: Istanbul, TR
Distribution: Red Hat, CentOS, Ubuntu
Posts: 180

Rep: Reputation: 30
Apache: View Website


Hi,

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.
 
Old 12-31-2012, 08:52 AM   #2
bijo505
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: Fedora & Ubuntu
Posts: 77

Rep: Reputation: 18
Hi,

Kindly have a look at the following URL, that will help you set up the virtual host

http://www.thegeekstuff.com/2011/07/...-virtual-host/
http://httpd.apache.org/docs/2.2/vhosts/index.html
http://httpd.apache.org/docs/2.2/vhosts/examples.html

--
Thanks,
Bijo
 
Old 12-31-2012, 09:10 AM   #3
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
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.

Code:
127.0.0.1       localhost
100.100.100.100 site1
100.100.100.100 site2
The first line is a standard entry in the hosts file on every system; add the other two (or more if you have more sites)

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.
 
Old 01-02-2013, 04:27 AM   #4
chief_officer
Member
 
Registered: Mar 2006
Location: Istanbul, TR
Distribution: Red Hat, CentOS, Ubuntu
Posts: 180

Original Poster
Rep: Reputation: 30
@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.
 
  


Reply

Tags
apache2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about setting up to view one website through another mrotsliah Linux - Networking 2 03-16-2010 07:22 PM
How to wget a random file from a website, then use FEH to view it. xmrkite Linux - Software 3 10-17-2006 02:26 PM
View Website Problem? TimmyWa Linux - Networking 1 02-25-2005 04:05 PM
View Website Problem? TimmyWa Red Hat 1 02-25-2005 03:14 PM
Can't View Website Through Windows (Apache 2.0, RH 9.0) TastyWheat Linux - Networking 5 08-22-2003 01:10 PM


All times are GMT -5. The time now is 11:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration