RE: [Nolug] php scripts virtual hosts

From: James Scott <jhs_technical_at_cox.net>
Date: Tue, 09 Mar 2004 12:27:06 -0600
Message-Id: <1078856825.3488.136.camel@example1.com>

On Tue, 2004-03-09 at 11:56, Pietu wrote:
> On Mon, 2004-03-08 at 21:53, Petri Laihonen wrote:
> > > On Mon, 2004-03-08 at 18:29, Joey Kelly wrote:
> > >> <snip>
> > >>
> > >> >
> > >> > Thanks Ray, Here are the relevant entries from the log.
> > >> > I really do not understand the first one and it is probably the core
> > >> > issue. I can see that index.php is defined in conf.d.
> > >> > [Mon Mar 08 16:27:56 2004] [error] [client 68.11.44.133] Directory
> > >> index
> > >> > forbidden by rule: /var/www/html/
> > >> > [Mon Mar 08 16:32:36 2004] [error] [client 68.11.44.133] File does
> not
> > >> > exist: /var/www/html/admin
> > >> > [Mon Mar 08 16:50:05 2004] [error] [client 68.11.44.133] Directory
> > >> index
> > >> > forbidden by rule: /var/www/html/
> > >> > script not found or unable to stat
> > >> > script not found or unable to stat
> > >> > [Mon Mar 08 17:31:19 2004] [error] [client 68.11.44.133] File does
> not
> > >> > exist: /var/www/html/new_downloads
> > >> > [Mon Mar 08 17:31:57 2004] [error] [client 68.11.44.133] File does
> not
> > >> > exist: /var/www/html/new_downloads
> > >>
> > >> At least part of that really looks like a permissions problem. What
> user
> > >> is
> > >> apache running under, and what user owns those files?
> > >>
> > >> I normally work out of my home directory, and tell apache to point any
> > >> virtual
> > >> hosts I have at some directory in /$user/public_html/
> > > Maybe this is it. I assumed apache would be running as apache and chown
> > > the files and directories apache. I just looked and one was root. I
> > > changed it to apache still doesn't work. I can't think no more. What
> > > should they be?
> > > The home directory thing would be cool but I opted for the virtual
> > > hosts. By the documentation it actually seemed just as easy. All you
> > > do is add couple of lines to the hosts file and set virtual container at
> > > the end of httpd.conf. Yeah sure.
> > >
> > > ___________________
> >
> > The errors you are seeing in the logs, I've seen them in the cases where I
> > had incorrectly configured path to the website in my httpd.conf file OR
> > when I did not have all the correct index files listed in httpd.conf
> This is exactly what I think the problem is.
> > Could you post the virtual host lines (container) from your httpd.conf and
> > equivalent directory structure of the site location on the server?
> The path:/var/www/example1/html
> Path 2: /var/www/example2/html
> 20040308 I added the following in the virtual hosts section of
> httpd.conf which is at the end of the file.
>
> This is supposed to be the right way to configure for a dhcp machine.
> I think I have missed an important concept somewhere.
> I setup the server names in the hosts file. These are not real sites
> I am setting up dummies for testing and to learn php and mysql.
> corresponding manual page:
> http://httpd.apache.org/docs-2.0/vhosts/examples.html#serverpath
> The section heading:
> "Running several name-based web sites on a single IP address."
> excerpt from file:
> ________________________________________________
> # Listen for virtual host requests on all IP addresses
> NameVirtualHost *
>
> <VirtualHost *>
> DocumentRoot /var/www/example1
> ServerName www.example1.com
>
> # Other directives here
> # the following were spec'd in php.conf tried to be explicit here
> # because php was not showing up
> AddType application/x-httpd-php .php
> DirectoryIndex index.php
> </VirtualHost>
>
> <VirtualHost *>
> DocumentRoot /var/www/example2
> ServerName www.example2.org
>
> # Other directives here
> AddType application/x-httpd-php .php
> DirectoryIndex index.php
> </VirtualHost>
> This gives me some flak on startup of httpd but still I get the
> default fedora page when I point the browser to www.example1.com
> and example2.org. I am actually using these names. What the hell.
> > Are you using IP based or name based virtual hosting?
> Name based.
> > Is the machine you are hosting behind the firewall?
> Is internal only.
> > btw. With apache 2.x I started using separate .conf file for virtual
> > hosts. At the bottom of the actual httpd.conf, I'm just 'including' it.
> Found this part.
>
> The new error message on httpd start up. Like I said it still seems to
> work and I copied this config section right off the manual page.
> Gotta read some more I think.
>
> "Starting httpd: [Tue Mar 09 10:45:02 2004] [error] VirtualHost
> _default_:443 -- mixing * ports and non-* ports with a NameVirtualHost
> address is not supported, proceeding with undefined results"
> Like I said it still seems to work and I copied this config section
> right off the manual page.
> Gotta read some more I think.
>
> > Petri
> ___________________
>
> I've never succeeded with those * asterixes in httpd.conf
I think I can see why. I am not liking it either.
>
> This is somewhat what I'm using at home. My server internal IP is
> 10.255.178.2 and in my workstation hosts file I've specified "10.255.178.2
> myserver.cmx" That way DNS is not involved deperately trying to find .cmx
> tld.
I get this part. This is standard stuff in small nets.
> 127.0.0.2 local address is there just to enable ssh tunneled access machine
> to see some stats and stuff. Instead of using http://localhost/ I can use
> http://mycron/. It is not needed in the conf.
Do you need a special directory path for this part? Not in the conf
file but a www/whatever/directory.
>
> the conf below will also respond to www.myserver.cmx. I've never been big on
> limiting the address with mandatory www. subdomain, instead one is free to
> use both 'myserver.cmx' and 'www.myserver.cmx'
The entry *.myserver.cmx does this?
>
> folder '/var/www/myserver.cmx' has normal web read access. Or if php needs
> to write something to HD then apache has the write access to specified
> folder.
The write access is to the log file specified?
>
> My example.
>
> NameVirtualHost 10.255.178.2
>
> <VirtualHost 10.255.178.2 127.0.0.2>
> ServerAdmin webmaster@localhost
> ServerName myserver.cmx
> ServerAlias *.myserver.cmx
> ServerAlias mycron #local 127.0.0.2
> DocumentRoot /var/www/myserver.cmx
> CustomLog /etc/httpd/logs/access_log combined
> </VirtualHost>
>
> I hope this helps a bit.
This is helping a lot.
> P
>
> ___________________
> Nolug mailing list
> nolug@nolug.org

___________________
Nolug mailing list
nolug@nolug.org
Received on 03/09/04

This archive was generated by hypermail 2.2.0 : 12/19/08 EST