LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-12-2007, 10:36 PM   #1
mbazdell
LQ Newbie
 
Registered: Nov 2007
Posts: 7

Rep: Reputation: 0
Question Apache2 Host Issue


Hi all. I have a weird issue here.. I'm trying to make my apache respond only to a certain domain name, rather than any name that will resolve to my ip... I have about 4 domain names that point to my ip, but I only want this server to respond to only one domain. Whenever I try to use

Code:
NameVirtualHost *
<VirtualHost *>
        ServerName foo.bar
It doesn't care and responds to any domain it can.

Code:
NameVirtualHost foo.bar
<VirtualHost foo.bar>
        ServerName foo.bar
Makes the server blow up and give 404 errors to anything. In the error log I only get

Quote:
File does not exist: /htdocs
Anybody have any ideas?
 
Old 11-13-2007, 05:46 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,455

Rep: Reputation: 104Reputation: 104
File does not exist: /htdocs

this indicates that the virtual server does not have a DocumentRoot so it looks for files in /htdocs
 
Old 11-13-2007, 06:11 AM   #3
mbazdell
LQ Newbie
 
Registered: Nov 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Ah sorry.. I should've given more of the config.. Here's the whole file. I basically just took the default file...

Code:
NameVirtualHost *
<VirtualHost *>
        ServerName foo.bar
        ServerAdmin support@foo.bar
        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
Everything is pretty much default. I don't think I changed anything really...
 
Old 11-13-2007, 06:24 AM   #4
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,455

Rep: Reputation: 104Reputation: 104
DocumentRoot "/var/www"

the quotes maybe...then restart server

<Directory "/var/www">

Last edited by j-ray; 11-13-2007 at 06:27 AM.
 
Old 11-13-2007, 06:39 AM   #5
mbazdell
LQ Newbie
 
Registered: Nov 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Same effect.. Strange that this is happening. Is there a way to get more info from the error logs? It still is looking for /htdocs and when I

Code:
/etc/apache2#> grep -r "htdocs"* *
Nothing comes up. Very bizarre.
 
Old 11-13-2007, 10:02 AM   #6
mbazdell
LQ Newbie
 
Registered: Nov 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Anybody else have an idea I should try? For the record I'm runnig this on Debian Etch.
 
Old 11-13-2007, 10:16 AM   #7
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,969

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Quote:
Originally Posted by mbazdell View Post
Same effect.. Strange that this is happening. Is there a way to get more info from the error logs? It still is looking for /htdocs and when I

Code:
/etc/apache2#> grep -r "htdocs"* *
Nothing comes up. Very bizarre.
Perhaps you use a different conf file containing different ServerRoot. Run
Code:
ps -ef|grep http
to see what you get.

Last edited by bathory; 11-13-2007 at 10:29 AM.
 
Old 11-13-2007, 05:50 PM   #8
mbazdell
LQ Newbie
 
Registered: Nov 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Code:
root     21822     1  0 Nov12 ?        00:00:00 /root/ispconfig/httpd/bin/ispconfig_httpd -DSSL
1001     21834 21822  0 Nov12 ?        00:00:00 /root/ispconfig/httpd/bin/ispconfig_httpd -DSSL
root     21970 21969  0 Nov12 ?        00:00:00 /root/ispconfig/cronolog --symlink=/var/log/httpd/ispconfig_access_log /var/log/httpd/ispconfig_access_log_%Y_%m_%d
1001     22139 21822  0 Nov12 ?        00:00:00 /root/ispconfig/httpd/bin/ispconfig_httpd -DSSL
root     25575   893  0 17:48 pts/1    00:00:00 grep http
Mind you the Apache I'm running is in a chroot. I have 3 http servers running. But only one in the chroot.
 
Old 11-13-2007, 07:02 PM   #9
mbazdell
LQ Newbie
 
Registered: Nov 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Just for more clarification, here is my setup.

One system:
Apache
ISPConfig (which has apache)
Mysql
etc...

Chroot system:
Apache
PostgreSQL


The reason why I've chroot'd an apache install is because I didn't want PSQL and MySQL to know about eachother... I wasn't sure if I could access the chroot'd PSQL server with the unchroot'd Apache...
 
Old 11-14-2007, 03:18 AM   #10
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,969

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
I guess that the 2 servers are listening on different ports, or different IPs. Anyway if you're running apache chrooted, then the config files are under /chroot-dir/etc/apache2, so you should check there to find what the DocumentRoot is.

Regards
 
Old 11-14-2007, 05:53 AM   #11
mbazdell
LQ Newbie
 
Registered: Nov 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Yeah that's what I'm editing. They're all running on different ports.
 
  


Reply

Tags
apache, apache2, virtualhost


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 virtual host. hgb Linux - Networking 10 01-24-2009 03:05 AM
Apache2 Virtual host on LAN jordankoppole Linux - Software 4 10-16-2007 10:57 AM
apache2 help -Virtual Host- Fredstar *BSD 4 06-06-2005 02:09 PM
Can't do Apache2 virtual host different ports SK_pt Linux - Software 3 01-30-2005 08:04 PM
[apache2] could not connect to host localhost LordFrancis Linux - Networking 1 09-30-2004 03:37 PM


All times are GMT -5. The time now is 07:54 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration