You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by cn...@eircom.net on 2002/05/03 19:36:39 UTC

named-based vhosts

Running Apache-1.3.19-5 on a RH-7.2 system. I'm trying to set up a virtual 
host.
When trying the URL for the virtual host  (www.harmonaircon.com) as well as 
the main server (www.irelands-web.ie) I get the following message for both:
"Forbidden
You do not permission to access / on this server"
I will post the relevant config files. I'm also going to include the DNS 
(bind-9.1.0) files and dir permissions as well as I'm not sure if the 
problems lies with apache or named, or even possibly directory permissions.
We own the DNS server for our domain(s). I know it's alot but I'm trying to 
be thorough as I've never set up a vhost before.
TIA

Chris

httpd.conf:

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
#Listen 3000
#Listen 12.34.56.78:80
Listen 194.125.22.1:80
#
# BindAddress: You can support virtual hosts with this option. This directive
# is used to tell the server which IP address to listen to. It can either
# contain "*", an IP address, or a fully qualified Internet domain name.
# See also the <VirtualHost> and Listen directives.
#
BindAddress 194.125.22.1

LoadModule vhost_alias_module modules/mod_vhost_alias.so

AddModule mod_vhost_alias.c

### Section 2: 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# If your ServerType directive (set earlier in the 'Global Environment'
# section) is set to "inetd", the next few directives don't have any
# effect since their settings are defined by the inetd configuration.
# Skip ahead to the ServerAdmin directive.
#

#
# Port: The port to which the standalone server listens. For
# ports < 1023, you will need httpd to be run as root initially.
#
Port 80

#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
#  . On SCO (ODT 3) use "User nouser" and "Group nogroup".
#  . On HPUX you may not be able to use shared memory as nobody, and the
#    suggested workaround is to create a user www and use that user.
#  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
#  when the value of (unsigned)Group is above 60000;
#  don't use Group nobody on these systems!
#
User nobody
Group nobody
Options ExecCgi

#
# ServerName: allows you to set a host name which is sent back to clients for
# your server if it's different than the one the program would get (i.e., use
# "www" instead of the host's real name).
#
# Note: You cannot just invent host names and hope they work. The name you
# define here must be a valid DNS name for your host. If you don't understand
# this, ask your network administrator.
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address (e.g., http://123.45.67.89/)
# anyway, and this will make redirections work in a sensible way.
#
ServerName www.irelands-web.ie
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"

#
# UserDir: The name of the directory which is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid.  This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
# See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
#
UserDir www


NameVirtualHost 194.125.22.1:80


<VirtualHost 194.125.22.1>
         ServerAdmin root@irelands-web.ie
         ServerName harmonaircon.com
         DocumentRoot /home/harmonaircon/www
         ErrorLog /var/log/httpd/access.log
         TransferLog /var/log/transferlog
</VirtualHost>

K that's what I think are the relevant parts....

/etc/named.conf:

// generated by named-bootconf.pl

options {
         directory "/var/named";
         /*
          * If there is a firewall between you and nameservers you want
          * to talk to, you might need to uncomment the query-source
          * directive below.  Previous versions of BIND always asked
          * questions using port 53, but BIND 8.1 uses an unprivileged
          * port by default.
          */

         //query-source address * port 53;
};

//
// File:       named.boot
// Purpose:    give the DNS its startup parameters and
// list of startup files.
//
//
//
//
// XFRNETS parameter limits the transfer of zone information
// to machines matching the subnet wildcard/mask entries listed
//
//
// XFRNETS
//
// establish a loopback entry for this machine, and tell
// it to load its identity from db.127.0.0
//
zone "0.0.127.IN-ADDR.ARPA" {
         type master;
         file "db.127.0.0";
};

//
// set ourselves as primary server for the zone
//
zone "irelands-web.ie" {
         type master;
         file "db.zoneinfo";
};

//
// provide reverse address-to-host mapping
//
zone "22.125.194.in-addr.arpa" {
         type master;
         file "db.194.125.22";
};

//
// prime the DNS with root server 'hint' information
//
zone "." {
         type hint;
         file "db.cache";
};

//

zone "yestoeurope.com" {
         type slave;
         file "db.europe";
         masters {
                 64.39.15.246;
         };
};

zone "cregornews.com" {
         type slave;
         file "db.cregor";
         masters {
                 64.39.15.246;
         };
};

zone "rt2000championship.com" {
         type slave;
         file "db.rt2000";
         masters {
                 64.39.15.246;
         };
};

zone "harmonaircon.com" {
         type master;
         file "db.harmon";
};

/var/named/db.zoneinfo:

$ORIGIN .
$TTL 172800     ; 2 days
irelands-web.ie         IN SOA  leviathan.irelands-web.ie. 
hostmaster.irelands-web.ie. (
                                 1998062504 ; serial
                                 21600      ; refresh (6 hours)
                                 7200       ; retry (2 hours)
                                 1209600    ; expire (2 weeks)
                                 172800     ; minimum (2 days)
                                 )
                         NS      ns.iol.ie.
                         NS      ns.pipex.net.
                         NS      titan.irelands-web.ie.
                         NS      leviathan.irelands-web.ie.
                         A       194.125.22.1
                         MX      5 GPO.irelands-web.ie.
                         MX      10 mxbackup.iol.net.
                         MX      50 relay.pipex.net.
$ORIGIN irelands-web.ie.
calisto                 A       194.125.22.2
                         MX      1 leviathan
$ORIGIN irelands-web.ie.
defunct                 A       194.125.22.111
ftp                     CNAME   leviathan
$ORIGIN irelands-web.ie.
GPO                     CNAME   leviathan
$ORIGIN irelands-web.ie.
keeper                  A       194.125.22.112
leviathan               A       194.125.22.1
                         MX      5 GPO
                         MX      10 mail.iol.ie.
                         MX      50 relay.pipex.net.
localhost               A       127.0.0.1
mail                    CNAME   leviathan
$ORIGIN irelands-web.ie.
ns                      CNAME   leviathan
$ORIGIN irelands-web.ie.
titan                   CNAME   leviathan
ww2                     CNAME   leviathan
www                     CNAME   leviathan
$ORIGIN harmonaircon.com
www                     A       194.125.22.1
                         MX      5 GPO
                         MX      10 mail.iol.ie.
                         MX      50 relay.pipex.net.

/var/named/db.194.125.22
$TTL 172800     ; 2 days
22.125.194.in-addr.arpa.         IN SOA leviathan.irelands-web.ie. 
hostmaster.irelands-web.ie. (
                                 1998062504 ; serial
                                 21600      ; refresh (6 hours)
                                 7200       ; retry (2 hours)
                                 1209600    ; expire (2 weeks)
                                 172800)    ; minimum (2 days)

                         NS      ns.iol.ie.
                         NS      ns.pipex.net.
                         NS      leviathan.irelands-web.ie.
                         NS      calisto.irelands-web.ie
;

/var/named/db.harmon

;
;    File:      db.vinfo
;    Purpose:   This file establishes the name/address information
;               for this zone.  You will have to fill out the actual
;               information for your specific zone in the format shown
;               in the comments.
;
$ORIGIN com.
$TTL 172800
harmonaircon.com        IN SOA    leviathan.irelands-web.ie. 
hostmaster.irelands-web.ie. (
                 2000040501   ; serial number
                 21600    ; refresh every 6 hours
                 7200     ; retry after 2 hours
                 1209600  ; expire after 2 weeks
                 259200)  ; default ttl is 2 days
;
          IN NS    leviathan.irelands-web.ie.
                 IN NS calisto.irelands-web.ie.
           IN MX   5 gpo.irelands-web.ie.
          IN MX    10 mail.iol.ie.
          IN MX    50 relay.pipex.net.
         IN      A       194.125.22.1
;ip address of harmonaircon.com with mail exchange records
$ORIGIN harmonaircon.com.
www     IN MX     5 GPO.irelands-web.ie.
         IN MX     10 mail.iol.ie.
         IN MX     50 relay.pipex.net.
         IN      A       194.125.22.1

Dir permissions:

  ls -la /var/www/
total 52940
drwxr-xr-x    5 root     root         4096 Jul 17  2001 .
drwxr-xr-x   22 root     root         4096 Mar 14 19:54 ..
drwxr-xr-x    2 root     root         4096 Mar 29  2001 cgi-bin
drwxr-xr-x   18 root     root         4096 Apr 19 20:47 html
-rw-r--r--    1 root     root     54132484 Jul 17  2001 htmldir
drwxr-xr-x    3 root     root         4096 Jul 10  2001 icons

  ls -la /var/www/html/index.html
-rw-r--r--    1 root    root        1037 Apr 19 20:44 /var/www/html/index.html

ls -la /home/harmonaircon/
total 16
drwx------    3 harmonai popusers     4096 Aug 26  2001 .
drwxr-xr-x  391 root     root         8192 Apr 22 17:26 ..
drwxr-xr-x    2 harmonai popusers     4096 Apr 30 16:16 www

ls -la /home/harmonaircon/www/index.html
-rw-r--r--    1 harmonai popusers      406 Aug 26  2001 
/home/harmonaircon/www/index.html



Anything else????
Be gentle :)




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: named-based vhosts

Posted by Joshua Slive <jo...@slive.ca>.
On Fri, 3 May 2002 cnb@eircom.net wrote:

> Running Apache-1.3.19-5 on a RH-7.2 system. I'm trying to set up a virtual
> host.
> When trying the URL for the virtual host  (www.harmonaircon.com) as well as
> the main server (www.irelands-web.ie) I get the following message for both:

Note that when using name virtual hosts, there really is no such thing as
the "main server" except as a place to keep defaults.  All hosts must have
a <virtualhost> section.

> "Forbidden
> You do not permission to access / on this server"

See:
http://httpd.apache.org/docs/misc/FAQ.html#forbidden

> ls -la /home/harmonaircon/
> total 16
> drwx------    3 harmonai popusers     4096 Aug 26  2001 .

Yes, indeed.  The permissions on that directory do not let anyone other
than harmonai even search it, so there is no way the web server can access
the content, given that it is running as "nobody".

Joshua.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org