Re: [Nolug] php scripts virtual hosts cleaned up

From: Mark A. Hershberger <mah_at_everybody.org>
Date: Wed, 10 Mar 2004 13:02:23 -0600
Message-ID: <873c8g8r0g.fsf@weblog.localhost>

James Scott <jhs_technical@cox.net> writes:

> First this cleaning up thing is a pain. I am going to attempt to get
> the relevant stuff in here.

It's worth the effort, though. You /would/ find this a lot easier if
you configured Outlook to prefix the message you are replying to with
"> " (or switched MUAs). That's another reason not to use Outlook's
default configuration in mailing lists where you want help: you'll
get more help if you post using the conventions that other people are
used to.

Enough preaching. Time to help.

> NameVirtualHost *
>
> <VirtualHost *>
> DocumentRoot /var/www/example1
> ServerName www.example1.com
>
>
> AddType application/x-httpd-php .php
> DirectoryIndex index.php
> </VirtualHost>

Are you actually using "www.example1.com"? Does it resolve
properly? If you are using another name, does it resolve properly?

Is there a file at /var/www/example1/index.php?

You get the following error:

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

Which indicates that you have other <VirtualHost> sections not in the
form <VirtualHost *> -- something that isn't allowed.

For my own configurations, putting

    NameVirtualHost *

and then using

    <VirtualHost *>
    ...
    </VirtualHost>

for every virtual host does the job.

> Attempting to access files html or php gave me these sort of log
> entries.
> log errors:
>
> [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 statp

This is because you've mis-configured your virtual hosts.

> And I also tried it with 127.0.0.0 net addresses. I believe I would
> have to set routes for those to use them and I cannot remember how
> now.

No, you wouldn't. Especially on Linux, all 127.* addresses are
routed through the lo interface -- they'll never end up on a live
network because the RFCs state that these addresses are local to the
machine.

(If you're using another OS -- Solaris, for example -- it is possible
that some 127.* addresses will end up on the network.)

If you wanted, you could set up a local network of 10.* or
192.168.*.* addresses, but you'd have to give each local machine an
IP in that range.

> [Tue Mar 09 14:20:21 2004] [error] [client 68.11.44.133] Invalid method
> in request \x80g\x01\x03

Something really strange is happening here. What sort of web client
are you using?

> [Tue Mar 09 14:20:26 2004] [error] [client 68.11.44.133] File does not
> exist: /var/www/example1/index.html

Does that file exist? Do you have /var/www/example1/index.html?
You forgot "DirectoryIndex index.php" in your <VirtualHost>
section, so it isn't going to go looking for an index.php file:

> <VirtualHost example1.com "actual ip address of localhost">
> ServerAdmin webmaster@localhost
> ServerName example1.com
> ServerAlias *.example1.com
> DocumentRoot /var/www/example1
> CustomLog /etc/httpd/logs/access_log combined
> </VirtualHost>

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

FWIW, try using ".localhost" instead of ".cmx" or
".whatever-you-want". That way, you future-protect the names you use
in the same way that you future-protect them by using 10.* addresses.

Mark.

-- 
A choice between one man and a shovel, or a dozen men with teaspoons
is clear to me, and I'm sure it is clear to you also.
    -- Zimran Ahmed <http://www.winterspeak.com/>
___________________
Nolug mailing list
nolug@nolug.org
Received on 03/10/04

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