LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-04-2005, 04:34 PM   #1
TheSpork
Member
 
Registered: May 2003
Location: Norway
Distribution: Ubuntu / Debian
Posts: 40

Rep: Reputation: 15
debian, apache2, ipcop and vhosts not working


I'm having a static ip-address and dns pointing to my internet-router. The router is connected to a computer running IPCop with three interfaces (red = internet, orange = dmz and green = LAN). I use NAT, and the red is configured with my static IP, orange is 192.168.2.0/255.255.255.0 and green is 192.168.3.0/255.255.255.0.

I've set up Apache to receive "www.domain.info" requests, and it works like a charm, and so does "domain.info" (without www). My problem starts when I try to set up virtual hosts. I've added "name1.domain.info" and "name2.domain.info" to dns, so they both points to my ip-address.

When I type "domain.info" in an external (or internal) browser, my index-page pops up. The problem is that this is the same page presented when I type "name1." or "name2.domain.info". They both end up at my main index-page. Typing "www.domain.info/~name1 or ~name2" works, as well as the aliases "/name1 and /name2".

My last attempt was to copy the config-files from a server that works, but that server doesn't use NAT, so I think this might be the root of my problems.

(From here, my static IP is aa.bbb.ccc.ddd)

My "apache2.conf" contains:

NameVirtualHost aa.bbb.ccc.ddd
Include /etc/apache2/httpd.conf (which is empty)
Include /etc/apache2/ports.conf (contains "Listen 80")
Include /etc/apache2/conf.d
Include /etc/apache2/sites-enabled

my file under /etc/apache2/sites-availiable (and link from sites-enabled by running a2ensite) contains:

<VirtualHost www.domain.info>
ServerAdmin webmaster@domain.info
ServerName www.domain.info
DocumentRoot /home/html/
ErrorLog /var/log/apache/error_log
TransferLog /var/log/apache2/transfer.log
ScriptAlias /cgi-bin /home/html/cgi-bin
Options ExecCgi Includes
ServerAlias domain.info
</VirtualHost>

<VirtualHost name1.domain.info>
ServerAdmin webmaster@domain.info
ServerName www.domain.info
DocumentRoot /home/name1/html
ErrorLog /var/log/apache2/name1_error_log
TransferLog /var/log/apache2/name1_transfer.log
ScriptAlias /cgi-bin /home/name1/html/cgi-bin
Options ExecCgi Includes
ServerAlias domain.info
</VirtualHost>

(I've tried changing from domain-name to ip-address as VirtualHost, but no luck..)

Does anyone see what's wrong? I certainly can't, and as I mentioned, I've copied the config-files from another domain "in panic"

Let me know if you need more info, and I'll paste it in..

Does it have anything to do with my NAT?
 
Old 06-04-2005, 05:01 PM   #2
TheSpork
Member
 
Registered: May 2003
Location: Norway
Distribution: Ubuntu / Debian
Posts: 40

Original Poster
Rep: Reputation: 15
YES! Finally I figured out what's wrong..

It was NAT that created the problem, and all I had to do was:

* add both external and internal address as a "NameVirtualHost" in the sites-availiable/default
NameVirtualHost 192.168.2.11
NameVirtualHost aa.bbb.ccc.ddd

* add both addresses in <VirtualHost 192.168.2.11 aa.bbb.ccc.ddd> instead of just <VirtualHost aa.bbb.ccc.ddd>

This has been bugging me for a week, so I REALLY hope this can help somebody else too!!
 
  


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 and php4 in Debian swmok Debian 1 06-09-2005 05:21 PM
debian + apache2 alaios Debian 2 05-31-2005 05:05 AM
strange vhosts prob w/ apache2 viniosity Linux - General 4 03-22-2005 07:51 AM
Apache Default web - Vhosts not working?? Raggit Linux - Software 1 02-04-2005 02:34 PM
Debian, apache2 and php4 Pasi Linux - Distributions 1 03-20-2003 07:28 PM


All times are GMT -5. The time now is 08:25 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration