LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 04: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, 05:45 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
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 05:59 PM.
 
Old 09-05-2014, 04: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



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 03:09 AM
Help - apache serves up my website from any URL! Mountain Linux - Server 1 02-18-2011 12:39 AM
[SOLVED] How to find URL for xampp website on my server anon091 Linux - Newbie 2 03-02-2010 09:01 AM
because I need 3 posts to get to show url's taurax Linux - Hardware 2 04-24-2006 10:45 AM

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

All times are GMT -5. The time now is 08:19 PM.

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
Open Source Consulting | Domain Registration