httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike" <>
Subject RE: Apache <virtualhost> configuration concerning PHP Help :-)
Date Sat, 22 Jun 2002 14:17:34 GMT
If you do a search on the group you'll find allot of information on this.
Here's what I got when I asked.


Yes, there's nothing sacred about the spelling of a directory name.  The
directory needs to be executable, . . .and there are some security
considerations that I'll not go into at this writing, but briefly, I usually
create a directory hierarchy on a device or partition away from the system
files, etc., such as /www/vhosts/ and set this as the DocumentRoot of
the ( virtual in the VirtualHost container in the httpd.conf file.
Then other subdirectories such as /www/vhosts/ and
/www/vhosts/ can be created.  I locate the index.htm (or
index.html, . . .however you've configured your system to acknowledge
spellings, etc.) in the directory; then all other html's are located
in or below the htdocs directory.

Any directory that falls below the DocumentRoot can (be configured to)
contain executable scripts; note that you can use a symbolic link to another
directory, perhaps a global or common repository for a script that may be
useful for all virtual hosts (see the option, FollowSymLinks).  You'll need
a general purpose Directory container (traditionally found in the
access.conf file, but I include in the httpd.conf file) that includes the
Options directive that will enable the ExecCGI option for the directory
path, for example:
<Directory "/www/vhosts/*/htdocs">
    Options Indexes FollowSymLinks ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
Notice the asterisk in the path to the htdocs -- this covers all virtual
hosts so configured with regard to the path structure.  Finally, remember,
this is just one solution -- I just noticed that Keith H. suggested using
the script aliase technique.  That may be quicker for you, but the method
that I've described works well for the security structure that I'm building.

Good Luck,
Ron W.

----- Original Message -----
Sent: Tuesday, June 18, 2002 11:15 AM
Subject: VirtualHost

Using VirtualHost can you also set up another CGI-BIN inside of it?
I do alot of testing and most of the installs already have a BIN directory
with thier DLL or CGI in them.
DocumentRoot d:/
DirectoryIndex index.cfm index.htm index.html


To unsubscribe, e-mail:
For additional commands, e-mail:

-----Original Message-----
From: Jiles McCoy []
Sent: Friday, June 21, 2002 11:56 PM
Subject: Apache <virtualhost> configuration concerning PHP Help :-)

Hello all,

I have installed Apache and all is running well. I now want to configure
Apache so that I can host multiple sites with a single IP address. On
top of this I wish to have PHP support (which is working with my current
Apache PHP installation). I can make Apache point to the correct folder
using a <VirtualHost> section but I am having problems getting the
scripts to run once I implement the <virtualhost entry>.

This is my configuration:

Windows XP Pro
Apache 2.0.39 path is c:\progrmam files\apache group\apache2\
PHP 4.2.1 (This is executing like a CGI)  path is c:\php

Here is the httpd.conf that works fine before adding the <virtualhost>

ServerRoot "C:/Program Files/Apache Group/Apache2"
PidFile logs/
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule mpm_winnt.c>
ThreadsPerChild 250
MaxRequestsPerChild  0
Listen 80
LoadModule access_module modules/
LoadModule actions_module modules/
LoadModule alias_module modules/
LoadModule asis_module modules/
LoadModule auth_module modules/
LoadModule autoindex_module modules/
LoadModule cgi_module modules/
LoadModule dir_module modules/
LoadModule env_module modules/
LoadModule imap_module modules/
LoadModule include_module modules/
LoadModule isapi_module modules/
LoadModule log_config_module modules/
LoadModule mime_module modules/
LoadModule negotiation_module modules/
LoadModule setenvif_module modules/
LoadModule userdir_module modules/

UseCanonicalName Off
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"
<Directory />
    Options FollowSymLinks
    AllowOverride None
<Directory "C:/Program Files/Apache Group/Apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
UserDir "My Documents/My Website"
DirectoryIndex index.html index.html.var
AccessFileName .htaccess
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
TypesConfig conf/mime.types
DefaultType text/plain
<IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
HostnameLookups Off
ErrorLog logs/error.log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog logs/access.log common
ServerSignature On
Alias /icons/ "C:/Program Files/Apache Group/Apache2/icons/"

<Directory "C:/Program Files/Apache Group/Apache2/icons">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
Alias /manual "C:/Program Files/Apache Group/Apache2/manual"
<Directory "C:/Program Files/Apache Group/Apache2/manual">
    Options Indexes FollowSymLinks MultiViews IncludesNoExec
    AddOutputFilter Includes html
    AllowOverride None
    Order allow,deny
    Allow from all
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"
<Directory "C:/Program Files/Apache Group/Apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
IndexOptions FancyIndexing VersionSort
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core

AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

DefaultIcon /icons/unknown.gif
ReadmeName README.html
HeaderName HEADER.html
AddEncoding x-compress Z
AddEncoding x-gzip gz tgz
AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .et
AddLanguage fr .fr
AddLanguage de .de
AddLanguage he .he
AddLanguage el .el
AddLanguage it .it
AddLanguage ja .ja
AddLanguage pl .po
AddLanguage ko .ko
AddLanguage pt .pt
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pt-br .pt-br
AddLanguage ltz .ltz
AddLanguage ca .ca
AddLanguage es .es
AddLanguage sv .se
AddLanguage cz .cz
AddLanguage ru .ru
AddLanguage tw .tw
AddLanguage zh-tw .tw
AddLanguage hr .hr
LanguagePriority en da nl et fr de el it ja ko no pl pt pt-br ltz ca es
sv tw
ForceLanguagePriority Prefer Fallback
AddDefaultCharset ISO-8859-1
AddCharset ISO-8859-1  .iso8859-1 .latin1
AddCharset ISO-8859-2  .iso8859-2 .latin2 .cen
AddCharset ISO-8859-3  .iso8859-3 .latin3
AddCharset ISO-8859-4  .iso8859-4 .latin4
AddCharset ISO-8859-5  .iso8859-5 .latin5 .cyr .iso-ru
AddCharset ISO-8859-6  .iso8859-6 .latin6 .arb
AddCharset ISO-8859-7  .iso8859-7 .latin7 .grk
AddCharset ISO-8859-8  .iso8859-8 .latin8 .heb
AddCharset ISO-8859-9  .iso8859-9 .latin9 .trk
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5        .Big5       .big5
AddCharset WINDOWS-1251 .cp-1251   .win-1251
AddCharset CP866       .cp866
AddCharset KOI8-r      .koi8-r .koi8-ru
AddCharset KOI8-ru     .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-8       .utf8
AddCharset GB2312      .gb2312 .gb
AddCharset utf-7       .utf7
AddCharset utf-8       .utf8
AddCharset big5        .big5 .b5
AddCharset EUC-TW      .euc-tw
AddCharset EUC-JP      .euc-jp
AddCharset EUC-KR      .euc-kr
AddCharset shift_jis   .sjis

AddType application/x-tar .tgz

ScriptAlias /php/ "c:/php/"
   AddType application/x-httpd-php .php
   Action application/x-httpd-php "/php/php.exe"
AddHandler type-map var

<IfModule mod_negotiation.c>
<IfModule mod_include.c>
    Alias /error/ "C:/Program Files/Apache Group/Apache2/error/"

    <Directory "C:/Program Files/Apache Group/Apache2/error">
        AllowOverride None
        Options IncludesNoExec
        AddOutputFilter Includes html
        AddHandler type-map var
        Order allow,deny
        Allow from all
        LanguagePriority en es de fr
        ForceLanguagePriority Prefer Fallback

    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
    ErrorDocument 410 /error/HTTP_GONE.html.var
    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
    ErrorDocument 415 /error/HTTP_SERVICE_UNAVAILABLE.html.var
    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
BrowserMatch "Microsoft Data Access Internet Publishing Provider"
BrowserMatch "^WebDrive" redirect-carefully
<IfModule mod_ssl.c>
    Include conf/ssl.conf

When I add the following <Virtualhost> entry Apache starts but when I
open I get an error.


    DocumentRoot "C:/Program Files/Apache
    ScriptAlias /php/ "c:/PHP/"
       AddType application/x-httpd-php .php
       Action application/x-httpd-php "c:/php/php.exe"

The error is :Your browser (or proxy) sent a request that this server
could not understand.

If I use the following V<virtualhost>:

    DocumentRoot "C:/Program Files/Apache
    ScriptAlias /php/ "c:/PHP/"

I get the error:   Premature end of script headers: php.exe

So I figure my problem is in the way I am setting up the PHP call in the

Thanks for any help and sorry for the LOOOONG message.

Jiles McCoy

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message