LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-10-2017, 09:27 AM   #1
neilh900
LQ Newbie
 
Registered: Oct 2017
Posts: 3

Rep: Reputation: Disabled
Question How do i change the order of virtual hosts in apache2 Unbuntu


How do i change the default virtual host that appears when i type my server IP address? i have configured vitrual hosts on .conf files under sites-available/

Its just I have a a site that may be coming down over the next few years and it is appearing as the default. apache2 has no http-d file nor does the apache2.conf file have any detail about which is the default.
 
Old 10-10-2017, 05:17 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,154
Blog Entries: 1

Rep: Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019
Quote:
Originally Posted by neilh900 View Post
How do i change the default virtual host that appears when i type my server IP address? i have configured vitrual hosts on .conf files under sites-available/

Its just I have a a site that may be coming down over the next few years and it is appearing as the default. apache2 has no http-d file nor does the apache2.conf file have any detail about which is the default.
Apache reads the vhosts filenames alphabetically, so if you want to change the vhosts order, change the respective filenames under /etc/apache2/sites-available and use a2dissite/a2ensite to disable/re-enable the vhosts in different alphabetical order

Regards
 
1 members found this post helpful.
Old 10-11-2017, 03:40 PM   #3
X-LFS-2010
Member
 
Registered: Apr 2016
Posts: 510

Rep: Reputation: 58
you can go by host name, and have multiple names per host (but this requires that you have a working resolver / bind). that might work. you can certainly assign multiple addresses to the same host and use a different address for each virtual host. (use hostname -I to see all host IPs, read about "multi-homing" and "aliases" in /etc/hosts)

I'm not %100 sure that having different "host names" for multiple virtual hosts all that resolve to the same IP works, so excuse me if I'm wrong. (for my LAN I use two different addresses: IP and localhost)

a better way might be to re-compile apache2, hacked to follow some rule you have for which virtual host is chosen given the same IP

ANOTHER answer is your server IP (if static) should be in virtual host not your host name

Last edited by X-LFS-2010; 10-11-2017 at 03:41 PM.
 
Old 10-11-2017, 03:49 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by neilh900 View Post
apache2 has no http-d file nor does the apache2.conf file have any detail about which is the default.
Try and review
Code:
apache2ctl -S
in terminal.
 
  


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
apache2 virtual hosts dave`2005 Ubuntu 1 11-19-2007 08:17 AM
Virtual hosts on apache2 70mas Linux - Server 3 07-16-2007 03:29 AM
Apache2 - need help with virtual hosts bioalchemist Linux - Software 5 08-11-2006 02:24 PM
Subdomains on Apache2 with virtual hosts - how? <Ol>Origy Linux - Networking 2 08-18-2005 06:53 AM
apache2 virtual hosts viniosity Linux - Software 4 02-07-2004 01:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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