Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 05-04-2013, 02:17 AM   #1
Senior Member
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 18.04
Posts: 1,669

Rep: Reputation: 55

Is it not possible to have multiple virtual sites enabled in apache2 in /etc/apache2/sites-enabled?

On my computer I have

pedro@peterpu:/etc/apache2/sites-available$ ls
babypage babypage~ default default-ssl


pedro@peterpu:/etc/apache2/sites-enabled$ ls
babypage babypage~

Question: is it not possible to have more than one virtual site in /etc/apache2/sites-enabled?? I disabled 000default, because my page would not start. Now it does.

If it is possible to have more than one site 'available', how do I address babypage in my browser when sites-enabled has more than one entry?? When I enter peterpu I always get the default page (when it is enabled) in /var/www It would be good to keep the default for, well, defaults, but also address babypage.
Old 05-04-2013, 11:38 AM   #2
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170
Take a look at what these files actually contain, and you will see that they are <virtualhost> entries. The master httpd.conf file, at some point, includes the content of that directory, thereby textually incorporating all of the other entries as though it all were one great big, drawn out file. (The directory is scanned in alphabetic order, I believe.)

Any computer can host any number of sites. The DNS system must map all of the various domain-names to the same IP-address (yours ...), then the different <virtualhost> entries in the various files will enable Apache to sort them all out. It examines the HTTP headers to figure out what domain-name is being addressed, associates them with one of those entries, and does what that entry says to do.

You might have to set up an /etc/hosts file on your local box, to send these particular domain-names (via loopback to back to your Apache instance ... your computer will refer to that file before making a DNS inquiry for the domain-name. However you do it, that domain-name must wind up being sent to the IP-address and port where Apache is listening.

Each entry must be sufficient to cause Apache to correctly dispatch the incoming HTTP messages to the appropriate site definitions. Check the Apache log-files.

Apache must be (soft-) restarted after any file changes are made. (Also consider apachectl configtest, which scans the configuration for syntax errors.)

Last edited by sundialsvcs; 05-04-2013 at 11:42 AM.
Old 05-04-2013, 06:14 PM   #3
Senior Member
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 18.04
Posts: 1,669

Original Poster
Rep: Reputation: 55
Thanks for that.

Now, I have babypage in sites-enabled, and after restarting apache, I enter peterpu in Firefox and get my webpage.

I had to actively disable the default, or that was the only page I got. So if I have 3 entries in sites-available, just out of interest, what must I enter in the browser to get a specific page? What must I enter elswhere to make say 3 different pages available?

Lets say I have the entries page1 page2 page3 in sites available, and I have done a2ensite for each one, and restarted apache2. This computer has the name peterpu How do I then choose which page??


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
[SOLVED] BASH: service apache2 start => check apache2 response dragonetti Linux - Newbie 2 10-29-2011 11:01 AM
[SOLVED] Compiling my own apache2 on debian -- no /usr/sbin/apache2 ??? jippen Linux - Server 2 11-30-2009 03:21 AM
Apache2 - have to restart apache2 process every 10 mins to clear /tmp directory.... levi dehaan Linux - Software 8 09-01-2009 06:34 PM
SuSe Apache2 error: cannot adjust 'apache2' service sir_shunt SUSE / openSUSE 14 04-18-2006 11:36 AM
how to uninstall apache2 which is installed by emerge apache2 flybirdlong Linux - Software 1 07-17-2004 11:46 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:44 PM.

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