LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-19-2011, 09:06 AM   #1
Logansanoh
LQ Newbie
 
Registered: May 2011
Posts: 3

Rep: Reputation: Disabled
Cannot access my other virtual hosts on ubuntu server


Hi all, first time poster, but please help. I have been searching and reconfiguring for 6 days now and have lost several clumps of hair..

PROBLEM:
I want 2+ virtual hosts on my ubuntu server (1 ip)
BUT - Only the first "alphabetically" listed sites-enabled shows.
000-default
www.domain1.com
www.domain2.com

Individually they all work (if i a2dissite for each leaving 1)

CONFIG:
UBUNTU 10.10 Server
EC2 instance (dont shoot me for this part - hoping this isnt the issue!)
APACHE 2.2.16
DNS my.domain.com
- to my public ec2 dns (this works)

Virtual Hosts:
# default

Code:
<VirtualHost *:80>
        DocumentRoot "/home/www/"
        <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Satisfy all
        </Directory>
        <Directory /home/www>
        Options Indexes Multiviews FollowSymLinks
        AllowOverride all
        Order allow,deny
        Allow from all
        </Directory>
        LogLevel debug
        ErrorLog /home/www/logs/error.log
        CustomLog /home/www/logs/access.log "combined"
</VirtualHost>
Virtual Host 1 - domain1

Code:
<VirtualHost *:80>
        ServerAdmin webmaster@domain1.com
        ServerName domain1.com
        ServerAlias domain1.com
        ServerAlias www.domain1.com
        # Indexes + Directory Root.
        DirectoryIndex index.php
        DocumentRoot "/home/www/www.domain1.com/"
        # Directory directive
        <Directory "/home/www/www.domain1.com">
                Options Indexes Multiviews FollowSymLinks
                AllowOverride none
                Order allow,deny
                Allow from all
        </Directory>
        # CGI Directory
        ScriptAlias /cgi-bin/ /home/www/www.domain1.com/cgi-bin
        <Location /cgi-bin>
                Options +ExecCGI
        </Location>
        # Logfiles
        LogLevel debug
        ErrorLog "/home/www/www.domain1.com/logs/error.log"
        CustomLog "/home/www/www.domain1.com/logs/access.log" combined
</VirtualHost>
I also have the above for domain2 in another document root with a different domain name

sym links are in place:
my apache2ctl -St shows the following -
VirtualHost configuration:
*:80 is a NameVirtualHost
default server (/etc/apache2/sites-enabled/000-default:4)
port 80 namevhost (/etc/apache2/sites-enabled/000-default:4)
port 80 namevhost domain1.com (/etc/apache2/sites-enabled/www.domain1.com:4)
port 80 namevhost www.domain2.com (/etc/apache2/sites-enabled/www.domain2.com:4)
Syntax OK

My ports.conf:
NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
NameVirtualHost *.443
Listen 443
</IfModule>

<IfModule mod_gnutls.c>
Listen 443
</IfModule>

No changes from default to my apache2.conf and httpd.conf is empty.

I have tried the following (and about a hundred others):


http://httpd.apache.org/docs/2.2/rewrite/vhosts.html
http://ubuntuforums.org/archive/inde...t-1466665.html
http://flurdy.com/docs/ec2/basics/index.html
http://www.webmasterworld.com/apache/3282118.htm

it seems i have tried everything that everyone else is having issues with but nothing seems to fix mine.

Possibilities:
1) EC2
2) Permissions on the files - I changed everything to the apache2 user "www-data" - no dice.
3) I am a dope...lets hope its that and one of you kind people point me to my issue.

Chat soon...ill be over here losing my hair.
Regards, Logansanoh
 
Old 05-20-2011, 05:13 AM   #2
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Your statements about SSL and gnutls made me think of this, but please clarify.
Are you having trouble accessing both sites via http (port 80), https (port 443) or both? Off hand, your vhost set up looks ok. Normally, I just put two vhost declarations in the 000-default configuration file. One thing you may be missing is the NameVirtualHost directive, which goes in another file typically. This will tell Apache to work with and identify the host by server name. Otherwise it will probably just pick the first vhost that matches *:80. SSL is a little trickier and while it will resolve name virtual hosts, you may or may not get the proper certificate. It depends on the Apache version and browser version and whether or not both support SNI. It used to be that server name was not part of the security protocol, but that is changing because it is getting common for multiple domain hosting and the needs/desire to encrypt traffic.
 
Old 05-20-2011, 07:36 AM   #3
Logansanoh
LQ Newbie
 
Registered: May 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks, but no joy

Thanks for taking the time,

my hosts.conf file is the one you are referring to.

I have the directive set as *:80
If I set it to ip:80, i get the same outcome...(ie, doesnt work)
If i set it to *, no result (its not advised anyway)

If I set it to the domain name, i get failure on the second vhost on apache restart.
 
Old 05-20-2011, 08:00 AM   #4
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Take a look in your /etc/apache2/ports.conf. Mine, from Ubuntu Server edition, looks like the following
Code:
NameVirtualHost *:80
NameVirtualHost *:443
Listen 80
Listen 443
Then in your 000-default file you can declare multiple hosts
Code:
<VirtualHost *:80>
    ServerName <site 1>
</VirtualHost>

<VirtualHost *:80>
    ServerName <site 2>
</VirtualHost>
If you are convinced this is how you have things set up, but are still not working, please look in your /var/log/apache2/error.log and you syslog. Perform a restart of apache and look for any warnings or errors. Given that you have non working sites, I am certain you will see something. If the error messages don't make sense, feel free to post them.
 
Old 05-20-2011, 09:34 AM   #5
Logansanoh
LQ Newbie
 
Registered: May 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
DNS!

Looks like it might be DNS related.
Trying a fix now...lets see what happens when the caches clear themselves!


Thanks noway for your time.
 
  


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
LXer: Setting Up Subversion And Trac As Virtual Hosts On An Ubuntu Server LXer Syndicated Linux News 0 01-13-2008 09:20 AM
LXer: Ubuntu Linux + Apache2 + Virtual Hosts + Syslog Server LXer Syndicated Linux News 0 09-09-2007 10:11 PM
Access apache virtual hosts from lan te_conway Linux - Networking 2 07-16-2002 09:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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