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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-04-2014, 05:02 PM
|
#1
|
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:
|
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
|
|
|
09-04-2014, 06:45 PM
|
#2
|
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,795
|
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.
|
|
|
09-05-2014, 05:18 PM
|
#3
|
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:
|
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.
|
|
|
All times are GMT -5. The time now is 08:15 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|