LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-04-2014, 05:02 PM   #1
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 554

Rep: Reputation: 30
Apache help: show website via ip and via url


Hi, i have a few sites I am testing with on my test server.

I have each site setup and can browse to each one. But I want to make it so that one of them shows up when the ip address itself is typed in.

Is this possible?

ie. mysite1.com and mysite2.com are on the same server. When you type in 192.168.1.100 into chrome/firefox/etc i want mysite1.com to come up.

-Thanks
 
Old 09-04-2014, 06:45 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724
Is 192.168.1.100 the server IP, if yes set DocumentRoot to mysite1.com root directory in httpd.conf

[edit]
Hmmm, no if virtual host are set
Quote:
When a request is received, the server first maps it to the best matching <VirtualHost> based on the local IP address and port combination only. Non-wildcards have a higher precedence. If no match based on IP and port occurs at all, the "main" server configuration is used.

If multiple virtual hosts contain the best matching IP address and port, the server selects from these virtual hosts the best match based on the requested hostname. If no matching name-based virtual host is found, then the first listed virtual host that matched the IP address will be used. As a consequence, the first listed virtual host for a given IP address and port combination is default virtual host for that IP and port combination.
http://httpd.apache.org/docs/2.4/mod...ml#virtualhost

Maybe set IP in virtual host directive then

Or use wildcards and make sure mysite1.com virtual host is defined before mysite2.com in config

Last edited by keefaz; 09-04-2014 at 06:59 PM.
 
Old 09-05-2014, 05:18 PM   #3
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 554

Original Poster
Rep: Reputation: 30
Perfect. Thanks
I changed the /etc/apache2/sites-available/mysite1 file to have this at the top:

<VirtualHost 192.168.1.100:80>


Then I restarted apache and it worked.
 
  


Reply


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
Redirect with URL not showing the new redirects URL link Apache RHEL 6 gdizzle Linux - Newbie 4 12-03-2013 04:09 AM
Help - apache serves up my website from any URL! Mountain Linux - Server 1 02-18-2011 01:39 AM
[SOLVED] How to find URL for xampp website on my server rjo98 Linux - Newbie 2 03-02-2010 10:01 AM
because I need 3 posts to get to show url's taurax Linux - Hardware 2 04-24-2006 11:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:37 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration