LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Apache2 - having trouble setting up multiple domains under debian etch (https://www.linuxquestions.org/questions/linux-software-2/apache2-having-trouble-setting-up-multiple-domains-under-debian-etch-780925/)

walterbyrd 01-08-2010 03:24 PM

Apache2 - having trouble setting up multiple domains under debian etch
 
I know I am using apache2, but I'm not sure if it's 2.2 or whatever. How can I can find out?

I am trying to follow the instructions from this site:

http://www.debian-administration.org/articles/412

But it does not work, apache will not even load.

My /etc/apache2/conf.d/virtual.conf looks like this:

Quote:

# We're running multiple virtual hosts.
#
NameVirtualHost *
I have a file called /etc/apache2/sites-available/default

I did not create that file, but as long as I only have that file enabled, apache works. Although I get is that default "it works" message.

I am not sure if I should use "site.com" for the site name, and "www.sitename.com" for the site alias, or the other way around.

My domain files look like this:

Quote:

#
# example.com (/etc/apache2/sites-available/example.com)
#
<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName example.com
ServerAlias www.example.com

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


# Logfiles
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
</VirtualHost>
My /var/www/example.com/index.html files do exist. And example.com is pingable.

Any glaring errors?

rweaver 01-08-2010 03:59 PM

I do hosting for a few dozen domains and I use this...

NameVirtualHost *
Code:

<VirtualHost *>

        ServerAdmin webmaster@template.tld
        ServerName template.tld
        ServerAlias *.template.tld

        DocumentRoot /var/www/template.tld/htdocs

        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>

        <Directory /var/www/template.tld/htdocs>
                Options Indexes FollowSymLinks MultiViews ExecCGI
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /var/www/template.tld/cgi-bin/
        <Directory "/var/www/template.tld/cgi-bin">
                AllowOverride All
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/www/template.tld/log/error.log

        LogLevel warn

        CustomLog /var/www/template.tld/log/access.log combined
        ServerSignature On

</VirtualHost>

Of course the script that sets this up creates all the relevant directories, sets permissions, adds users, etc...

Don't forget to make a symlink between /sites-available and /sites-enabled, make sure the directories exist, make sure the dns is setup to point to this machine, and if that doesn't work include a copy of your system and site access/error logs (last 20 lines) in your reply.

walterbyrd 01-08-2010 06:15 PM

I still get a "Page Load Error" should this tell me anything?

/var/log/apache2/access.log
Quote:

::1 - - [08/Jan/2010:14:26:29 -0700] "GET / HTTP/1.0" 302 315 "-" "Apache/2.2.3 (Debian) (internal dummy connection)"
::1 - - [08/Jan/2010:14:26:29 -0700] "GET / HTTP/1.0" 302 315 "-" "Apache/2.2.3 (Debian) (internal dummy connection)"
::1 - - [08/Jan/2010:14:26:30 -0700] "GET / HTTP/1.0" 302 315 "-" "Apache/2.2.3 (Debian) (internal dummy connection)"
::1 - - [08/Jan/2010:14:26:30 -0700] "GET / HTTP/1.0" 302 315 "-" "Apache/2.2.3 (Debian) (internal dummy connection)"
::1 - - [08/Jan/2010:14:26:30 -0700] "GET / HTTP/1.0" 302 315 "-" "Apache/2.2.3 (Debian) (internal dummy connection)"
::1 - - [08/Jan/2010:17:04:39 -0700] "GET / HTTP/1.0" 302 315 "-" "Apache/2.2.3 (Debian) (internal dummy connection)"
::1 - - [08/Jan/2010:17:04:39 -0700] "GET / HTTP/1.0" 302 315 "-" "Apache/2.2.3 (Debian) (internal dummy connection)"
::1 - - [08/Jan/2010:17:04:39 -0700] "GET / HTTP/1.0" 302 315 "-" "Apache/2.2.3 (Debian) (internal dummy connection)"
::1 - - [08/Jan/2010:17:04:39 -0700] "GET / HTTP/1.0" 302 315 "-" "Apache/2.2.3 (Debian) (internal dummy connection)"
::1 - - [08/Jan/2010:17:04:39 -0700] "GET / HTTP/1.0" 302 315 "-" "Apache/2.2.3 (Debian) (internal dummy connection)"

walterbyrd 01-08-2010 07:03 PM

Using your script as a template, what happens now is: apache will reload, but I get "page load errors." Then if I try to reload apache again, apache will not reload. If I go back and a2dissite example.com, then apache will reload.

Quote:

# a2ensite example.com
Site example.com installed; run /etc/init.d/apache2 reload to enable.
# /etc/apache2/sites-available# /etc/init.d/apache2 reload
Reloading web server config...1432
.
# /etc/init.d/apache2 reload
Reloading web server config...1432
httpd not running, trying to start
failed!
# /etc/apache2/sites-available# a2dissite example.com
Site example.com disabled; run /etc/init.d/apache2 reload to fully disable.
# /etc/apache2/sites-available# /etc/init.d/apache2 reload
Reloading web server config...1432
httpd not running, trying to start
e# /etc/init.d/apache2 reload
Reloading web server config...31756


All times are GMT -5. The time now is 04:54 PM.