Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Sep 2002 17:35:49 +0800
From:      Ihsan Junaidi Ibrahim <ihsan_junaidi@yahoo.com.sg>
To:        freebsd-questions@freebsd.org
Subject:   Re: Apache CGI problem
Message-ID:  <17111258769.20020926173549@yahoo.com.sg>
In-Reply-To: <OE390yAEWopcnvy3JdZ00000da4@hotmail.com>
References:  <7110332537.20020926031500@yahoo.com.sg> <8665wt1s22.fsf@foo.bar> <8532227560.20020926091955@yahoo.com.sg> <86r8fhzeyu.fsf@foo.bar> <10235792456.20020926101920@yahoo.com.sg> <OE68vjkO22ZhCl8aii00000053b@hotmail.com> <389295255.20020926170305@yahoo.com.sg> <OE390yAEWopcnvy3JdZ00000da4@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello all,

Unix wrote:
> Is your apache server doing virtual hosting
> Could you provide me your httpd.conf file

OK,  here's  the  file plus the offending virtual hosts. These are the two hosts
that  use  the cgi-bin. Yes I use virtual hosting. I do a local lan-based sites
using local name server, just to get the hang of it first.

httpd.conf
-----------
##
## httpd.conf -- Apache HTTP server configuration file
##

#
# This is the main Apache server configuration file.
#

### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# ServerType is either inetd, or standalone.
#
ServerType standalone

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
ServerRoot "/usr/local"

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
PidFile /var/run/httpd.pid

#
# ScoreBoardFile: File used to store internal server process information.
# Not all architectures require this.
#
ScoreBoardFile /var/run/httpd.scoreboard

#
# Ignore srm.conf & access.conf.
#
ResourceConfig /dev/null
AccessConfig   /dev/null

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

#
# Server-pool size regulation.
#
MinSpareServers 5
MaxSpareServers 10

#
# Number of servers to start initially --- should be a reasonable ballpark
# figure.
#
StartServers 2

#
# Limit on total number of servers running, i.e., limit on the number
# of clients who can simultaneously connect --- if this limit is ever
# reached, clients will be LOCKED OUT, so it should NOT BE SET TOO LOW..
#
MaxClients 150

#
# MaxRequestsPerChild: the number of requests each child process is
# allowed to process before the child dies.
#
MaxRequestsPerChild 0

#
# Dynamic Shared Object (DSO) Support
#
LoadModule mmap_static_module libexec/apache/mod_mmap_static.so
LoadModule vhost_alias_module libexec/apache/mod_vhost_alias.so
LoadModule env_module         libexec/apache/mod_env.so
LoadModule define_module      libexec/apache/mod_define.so
LoadModule config_log_module  libexec/apache/mod_log_config.so
LoadModule mime_magic_module  libexec/apache/mod_mime_magic.so
LoadModule mime_module        libexec/apache/mod_mime.so
LoadModule negotiation_module libexec/apache/mod_negotiation.so
LoadModule status_module      libexec/apache/mod_status.so
LoadModule info_module        libexec/apache/mod_info.so
LoadModule includes_module    libexec/apache/mod_include.so
LoadModule autoindex_module   libexec/apache/mod_autoindex.so
LoadModule dir_module         libexec/apache/mod_dir.so
LoadModule cgi_module         libexec/apache/mod_cgi.so
LoadModule asis_module        libexec/apache/mod_asis.so
LoadModule imap_module        libexec/apache/mod_imap.so
LoadModule action_module      libexec/apache/mod_actions.so
LoadModule speling_module     libexec/apache/mod_speling.so
LoadModule userdir_module     libexec/apache/mod_userdir.so
LoadModule alias_module       libexec/apache/mod_alias.so
LoadModule rewrite_module     libexec/apache/mod_rewrite.so
LoadModule access_module      libexec/apache/mod_access.so
LoadModule auth_module        libexec/apache/mod_auth.so
LoadModule anon_auth_module   libexec/apache/mod_auth_anon.so
LoadModule db_auth_module     libexec/apache/mod_auth_db.so
LoadModule digest_module      libexec/apache/mod_digest.so
LoadModule proxy_module       libexec/apache/libproxy.so
LoadModule cern_meta_module   libexec/apache/mod_cern_meta.so
LoadModule expires_module     libexec/apache/mod_expires.so
LoadModule headers_module     libexec/apache/mod_headers.so
LoadModule usertrack_module   libexec/apache/mod_usertrack.so
LoadModule unique_id_module   libexec/apache/mod_unique_id.so
LoadModule setenvif_module    libexec/apache/mod_setenvif.so
LoadModule php4_module        libexec/apache/libphp4.so
LoadModule perl_module        libexec/apache/libperl.so
LoadModule gzip_module        libexec/apache/mod_gzip.so
<IfDefine SSL>
LoadModule ssl_module         libexec/apache/libssl.so
</IfDefine>

#  Reconstruction of the complete module list from all available modules
#  (static and shared ones) to achieve correct module execution order.
#  [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]
ClearModuleList
AddModule mod_mmap_static.c
AddModule mod_vhost_alias.c
AddModule mod_env.c
AddModule mod_define.c
AddModule mod_log_config.c
AddModule mod_mime_magic.c
AddModule mod_mime.c
AddModule mod_negotiation.c
AddModule mod_status.c
AddModule mod_info.c
AddModule mod_include.c
AddModule mod_autoindex.c
AddModule mod_dir.c
AddModule mod_cgi.c
AddModule mod_asis.c
AddModule mod_imap.c
AddModule mod_actions.c
AddModule mod_speling.c
AddModule mod_userdir.c
AddModule mod_alias.c
AddModule mod_rewrite.c
AddModule mod_access.c
AddModule mod_auth.c
AddModule mod_auth_anon.c
AddModule mod_auth_db.c
AddModule mod_digest.c
AddModule mod_proxy.c
AddModule mod_cern_meta.c
AddModule mod_expires.c
AddModule mod_headers.c
AddModule mod_usertrack.c
AddModule mod_unique_id.c
AddModule mod_so.c
AddModule mod_setenvif.c
AddModule mod_php4.c
AddModule mod_perl.c
AddModule mod_gzip.c
<IfDefine SSL>
AddModule mod_ssl.c
</IfDefine>

#
# Server status & info
#
ExtendedStatus On

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

#
# Port: The port to which the standalone server listens. For
# ports < 1023, you will need httpd to be run as root initially.
#
Listen 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 www
Group www

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.
#
#ServerAdmin root@localhost

#
# 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).
#
#ServerName localhost

#
# DocumentRoot: The directory out of which you will serve your
# documents.
#
#DocumentRoot "/var/www/data"

#
# Each directory to which Apache has access, can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).  
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

#
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index.  Separate multiple entries with spaces.
#
DirectoryIndex index.php index.phtml index.html

#
# AccessFileName: The name of the file to look for in each directory
# for access control information.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess files from being viewed by
# Web clients.
#
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>

#
# UseCanonicalName:  (new for 1.3)  With this setting turned on, whenever
# Apache needs to construct a self-referencing URL (a URL that refers back
# to the server the response is coming from) it will use ServerName and
# Port to form a "canonical" name.
#
UseCanonicalName On

#
# TypesConfig describes where the mime.types file (or equivalent) is
# to be found.
#
<IfModule mod_mime.c>
    TypesConfig /usr/local/etc/apache/mime.types
</IfModule>

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
#
DefaultType text/plain

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.
#
<IfModule mod_mime_magic.c>
    MIMEMagicFile /usr/local/etc/apache/magic
</IfModule>

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
#
HostnameLookups Off

#
# ErrorLog: The location of the error log file.
#
ErrorLog /var/log/httpd-error.log

#
# LogLevel: Control the number of messages logged to the error_log.
#
LogLevel warn

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

#
# If you prefer a single logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
CustomLog /var/log/httpd-access.log combined

#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (error documents, FTP directory listings,
# mod_status and mod_info output etc., but not CGI generated documents).
#
ServerSignature On

#
# Directives controlling the display of server-generated directory listings.
#
<IfModule mod_autoindex.c>

    Alias /icons "/var/www/icons"
    <Directory "/var/www/icons">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    #
    # FancyIndexing is whether you want fancy directory indexing or standard
    #
    IndexOptions FancyIndexing

    #
    # AddIcon* directives tell the server which icon to show for different
    # files or filename extensions.  These are only displayed for
    # FancyIndexed directories.
    #
    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 is which icon to show for files which do not have an icon
    # explicitly set.
    #
    DefaultIcon /icons/unknown.gif

    #
    # AddDescription allows you to place a short description after a file in
    # server-generated indexes.
    #
    #AddDescription "GZIP compressed document" .gz
    #AddDescription "tar archive" .tar
    #AddDescription "GZIP compressed tar archive" .tgz

    #
    # ReadmeName is the name of the README file the server will look for by
    # default, and append to directory listings.
    #
    # HeaderName is the name of a file which should be prepended to
    # directory indexes. 
    #
    # If MultiViews are amongst the Options in effect, the server will
    # first look for name.html and include it if found.
    #
    ReadmeName README
    HeaderName HEADER

    #
    # IndexIgnore is a set of filenames which directory indexing should ignore
    # and not include in the listing.
    #
    IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

</IfModule>

#
# Document types.
#
<IfModule mod_mime.c>

    #
    # AddEncoding allows you to have certain browsers (Mosaic/X 2.1+) uncompress
    # information on the fly.
    #
    AddEncoding x-compress Z
    AddEncoding x-gzip gz tgz

    #
    # AddLanguage allows you to specify the language of a document. 
    #
    AddLanguage da .dk
    AddLanguage nl .nl
    AddLanguage en .en
    AddLanguage et .ee
    AddLanguage fr .fr
    AddLanguage de .de
    AddLanguage el .el
    AddLanguage he .he
    AddCharset ISO-8859-8 .iso8859-8
    AddLanguage it .it
    AddLanguage ja .ja
    AddCharset ISO-2022-JP .jis
    AddLanguage kr .kr
    AddCharset ISO-2022-KR .iso-kr
    AddLanguage nn .nn
    AddLanguage no .no
    AddLanguage pl .po
    AddCharset ISO-8859-2 .iso-pl
    AddLanguage pt .pt
    AddLanguage pt-br .pt-br
    AddLanguage ltz .lu
    AddLanguage ca .ca
    AddLanguage es .es
    AddLanguage sv .sv
    AddLanguage cz .cz
    AddLanguage ru .ru
    AddLanguage zh-tw .tw
    AddLanguage tw .tw
    AddCharset Big5         .Big5    .big5
    AddCharset WINDOWS-1251 .cp-1251
    AddCharset CP866        .cp866
    AddCharset ISO-8859-5   .iso-ru
    AddCharset KOI8-R       .koi8-r
    AddCharset UCS-2        .ucs2
    AddCharset UCS-4        .ucs4
    AddCharset UTF-8        .utf8

    # LanguagePriority allows you to give precedence to some languages
    # in case of a tie during content negotiation.
    #
    <IfModule mod_negotiation.c>
        LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
    </IfModule>

    #
    # AddType allows you to tweak mime.types without actually editing it, or to
    # make certain files to be certain types.
    #
    AddType application/x-tar .tgz

</IfModule>

#
# Customize behaviour based on the browser
#
<IfModule mod_setenvif.c>

    #
    # The following directives modify normal HTTP response behavior to
    # handle known problems with browser implementations.
    #
    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

</IfModule>

#
# SSL-specific configurations
#
<IfModule mod_ssl.c>
    Include etc/apache/ssl.conf
</IfModule>


### Section 3: Virtual Hosts

#
# Use name-based virtual hosting.
#
NameVirtualHost 10.0.0.4

# Hosted sites
Include etc/apache/vhosts
----------------------------------------------------------

ihsan.lan
----------------------------------------------------------
<VirtualHost www.ihsan.lan>
    ServerAdmin ihsan@trigger.lan
    DocumentRoot "/home/ihsan/www"
    ServerName www.ihsan.lan
    ErrorLog /var/log/httpd/ihsan.lan/error.log
    CustomLog /var/log/httpd/ihsan.lan/access.log combined

    <Directory "/home/ihsan/www">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    
    <Directory "/home/ihsan/www/docs">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    
    ErrorDocument 404 /error-404.php 
    ErrorDocument 500 /error-500.php

    # CGI-Bin
    ScriptAlias /cgi-bin "/home/ihsan/cgi-bin"
    <Directory "/home/ihsan/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
------------------------------------------------------

secure.trigger.lan
------------------------------------------------------
<VirtualHost secure.trigger.lan:443>
    DocumentRoot /var/www/data
    ServerName secure.trigger.lan
    ServerAdmin ihsan@trigger.lan
    ErrorLog /var/log/httpd-error.log
    CustomLog /var/log/httpd-access.log combined
    CustomLog /var/log/ssl_request.log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

    # CGI-Bin
    ScriptAlias /cgi-bin "/var/www/cgi-bin"
    <Directory "/var/www/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>   
    
    Alias /dba "/var/www/phpMyAdmin"
    <Directory "/var/www/phpMyAdmin">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    # SSL Engine Switch
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile /etc/ssl/certs/secure.trigger.lan.cert
    SSLCertificateKeyFile /etc/ssl/private/secure.trigger.lan.key
    
    Alias /error/ "/var/www/error/"
    <Directory "/var/www/error">
        AllowOverride None
        Options IncludesNoExec
        Order allow,deny
        Allow from all
    </Directory>    
    ErrorDocument 404 /error/error-404.php 
    ErrorDocument 500 /error/error-500.php
   
</VirtualHost>
------------------------------------------------------


-- 
Thank you for your time,
Ihsan

__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?17111258769.20020926173549>