LinuxQuestions.org
Review your favorite Linux distribution.
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 05-04-2013, 03:17 AM   #1
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 14.04
Posts: 1,555

Rep: Reputation: 45
apache2


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-available$

and

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


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, 12:38 PM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,606
Blog Entries: 4

Rep: Reputation: 2997Reputation: 2997Reputation: 2997Reputation: 2997Reputation: 2997Reputation: 2997Reputation: 2997Reputation: 2997Reputation: 2997Reputation: 2997Reputation: 2997
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 127.0.0.1) 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 12:42 PM.
 
Old 05-04-2013, 07:14 PM   #3
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 14.04
Posts: 1,555

Original Poster
Rep: Reputation: 45
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??
 
  


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

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

All times are GMT -5. The time now is 03: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