LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 04-21-2010, 10:19 AM   #1
rantastic
LQ Newbie
 
Registered: Dec 2009
Posts: 7

Rep: Reputation: 0
debian lenny - all virtual hosts lead to first virtual host


Hey everyone,

I'm having an issue with setting up the virtual hosts on my web server. I have 2 virtual hosts (example1.com, example2.com). example1.com works but example2.com is sent to the index file of example1.com. I did some searching on google and it seems the problem might be with my /etc/hosts file.

First virtual host that the second is also directed to...in sites-available/sites-enabled (note port 80 is blocked by my isp so I use 8080)
Code:
#
#  example1.com (/etc/apache2/sites-available/www.example.com)
#
<VirtualHost *:8080>
        ServerAdmin billjohnston4@gmail.com
        ServerName  example1.com
        ServerAlias example1.com *.example1.com

        # Indexes + Directory Root.
        DirectoryIndex index.html
        DocumentRoot /var/www/example1.com/htdocs/

        # CGI Directory
        ScriptAlias /cgi-bin/ /var/www/example1.com/cgi-bin/
        <Location /cgi-bin>
                Options +ExecCGI
        </Location>


        # Logfiles
        ErrorLog  /var/www/example1.com/logs/error.log
        CustomLog /var/www/example1.com/logs/access.log combined
</VirtualHost>
Second virtual host file
Code:
#
#  example2.com (/etc/apache2/sites-available/example2.com)
#
<VirtualHost *:8080>
        ServerAdmin billjohnston4@gmail.com
        ServerName  example2.com
        ServerAlias example2.com *.example2.com

        # Indexes + Directory Root.
        DirectoryIndex index.html
        DocumentRoot /var/www/example2.com/htdocs/

        # CGI Directory
        ScriptAlias /cgi-bin/ /var/www/example2.com/cgi-bin/
        <Location /cgi-bin>
                Options +ExecCGI
        </Location>


        # Logfiles
        ErrorLog  /var/www/example2.com/logs/error.log
        CustomLog /var/www/example2.com/logs/access.log combined
</VirtualHost>
and my hosts file
Code:
127.0.0.1       localhost.localdomain           localhost
192.168.1.1     server1.example2.com  server1

127.0.0.1       example2.com
127.0.0.1       example1.com

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
Also I'm using a dyndns.org...would that make a difference?

Any help on this would be greatly appreciated

Thanks,
Bill
 
Old 04-21-2010, 04:58 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Specify the dyndns name in the configs also.
 
Old 04-21-2010, 09:32 PM   #3
rantastic
LQ Newbie
 
Registered: Dec 2009
Posts: 7

Original Poster
Rep: Reputation: 0
...sorry

So it turns out it was a completely different problem having to do with web forwards and the dynamic dns. My virtual host set up worked as is when I fixed the forwards.

Sorry for the trouble.
 
  


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
how to set apache virtual hosts Host-Based Security? hocheetiong Linux - Newbie 2 01-17-2014 04:20 AM
Is there anyway for one Virtual Server to access the main host, or another Virtual Se abefroman Linux - Security 5 01-08-2010 08:06 PM
debian lenny virtual host 403 secretlydead Linux - Server 1 09-29-2009 12:44 AM
Adding virtual interface for IP based virtual host pridefc Linux - General 6 03-16-2008 03:52 PM
virtual users and virtual host need to stay at /home nephish Linux - Networking 3 01-14-2006 01:36 PM

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

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