LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Apache2 Host Issue (http://www.linuxquestions.org/questions/linux-networking-3/apache2-host-issue-599196/)

mbazdell 11-12-2007 09:36 PM

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?

j-ray 11-13-2007 04:46 AM

File does not exist: /htdocs

this indicates that the virtual server does not have a DocumentRoot so it looks for files in /htdocs

mbazdell 11-13-2007 05:11 AM

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...

j-ray 11-13-2007 05:24 AM

DocumentRoot "/var/www"

the quotes maybe...then restart server

<Directory "/var/www">

mbazdell 11-13-2007 05:39 AM

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.

mbazdell 11-13-2007 09:02 AM

Anybody else have an idea I should try? For the record I'm runnig this on Debian Etch.

bathory 11-13-2007 09:16 AM

Quote:

Originally Posted by mbazdell (Post 2957317)
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.

mbazdell 11-13-2007 04:50 PM

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.

mbazdell 11-13-2007 06:02 PM

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...

bathory 11-14-2007 02:18 AM

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

mbazdell 11-14-2007 04:53 AM

Yeah that's what I'm editing. They're all running on different ports.


All times are GMT -5. The time now is 09:05 AM.