On Jun 30, 2007, at 10:55 AM, x x wrote:
I run # apache2ctl start
Ian, DON'T ! USE THE FULL PATH, PLEASE READ BELOW ...This took quite a while to write, that's why I didn't get back to you earlier...
# Assuming that you are trying to do virtual hosting, or at least have, or
# at least one real domain. #TRY : # ( 1 ) $ sudo /opt/local/apache2/bin/httpd -S # If that does not work try : # ( 2 ) $ sudo /opt/local/apache2/bin/httpd configtest# +---------+---------+---------+---------+---------+--------- +---------+---------+
# ( 3 ) Your httpd.conf should have something like this:# +---------+---------+---------+---------+---------+--------- +---------+---------+
<IfModule ssl_module> SSLRandomSeed startup builtin SSLRandomSeed connect builtin SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown SSLPassPhraseDialog exec:conf/getsslpassphrase SSLSessionCache dbm:logs/ssl_scache SSLSessionCacheTimeout 300 SSLMutex file:logs/ssl_mutex AddType application/x-x509-ca-cert crt AddType application/x-pkcs7-crl crl </IfModule># +---------+---------+---------+---------+---------+--------- +---------+---------+
# ( 4 ) Your httpd.conf should have something like this:# +---------+---------+---------+---------+---------+--------- +---------+---------+
Listen 127.0.0.1:80 NameVirtualHost 127.0.0.1:80 Listen 127.0.0.1:443 NameVirtualHost 127.0.0.1:443# +---------+---------+---------+---------+---------+--------- +---------+---------+
# ( 5 ) Try this at the Terminal:# +---------+---------+---------+---------+---------+--------- +---------+---------+
[2007.30.06](07:00PM) -> [username] ~ $ sudo find / -name apachectl Password:/Installers/Server/ZendStudioServer-4.0.0a-darwin6.8-ppc/data/apache/ bin/apachectl
/opt/local/apache2/bin/apachectl/opt/local/var/db/dports/software/apache2/2.2.4_0+openldap/opt/local/ apache2/bin/apachectl
/usr/sbin/apachectl# +---------+---------+---------+---------+---------+--------- +---------+---------+
# ( 5 ) COMMENTS:# +---------+---------+---------+---------+---------+--------- +---------+---------+ # You may get more than one result for "apachectl" in a "bin" or "sbin" dir as shown above
## You may see more than one "apachectl" associated with a "bin" or "sbin", both paths which # are bound to be in the ~/,bash_profile, ~/.bashrc . Here we see two that may cause a conflict # it they are associated with different versions, such as apache 1.3.x, and apache 2.x.x
## Depending upon the order, in which the PATH contains these directories you may be getting incorrect # results during startup, especially if you removed the apache 1.3.x, but the PATH to searched yields the # "apachectl" for the incorrect version, which may be non-existent on your drive.
## +---------+---------+---------+---------+---------+--------- +---------+---------+
# ( 6 ) If I open "/opt/local/apache2/bin/apachectl" in BBEdit# +---------+---------+---------+---------+---------+--------- +---------+---------+
# <snip># # |||||||||||||||||||| START CONFIGURATION SECTION |||||||||||||||||||| # # -------------------- --------------------
# # # # the path to your httpd binary, including options if necessary # HTTPD='/opt/local/apache2/bin/httpd' # # <snip># +---------+---------+---------+---------+---------+--------- +---------+---------+
# ( 7 ) If I open "/usr/sbin/apachectl" in BBEdit and do a compare,# +---------+---------+---------+---------+---------+--------- +---------+---------+ # It becomes obvious that this is the old version, whci should no longer be there. # I never call "apachectl" without the full path in order to avoid these problems.
# In my case apache 1.3 came installed on my machine, and apparently this one was # installed in this directory. It makes more sense the way it's done in apache2, which is # to have an /etc/httpd/bin/apachectl, then create a symbolic link / usr/sbin/apachectl_1 # and create a symlink to /opt/local/apache2/bin/apachectl at /usr/ sbin/apachectl_2
# but all this is wishful thinking. # Reality is to make sure you use the full path to apachectl...# +---------+---------+---------+---------+---------+--------- +---------+---------+
# # <snip> ## # |||||||||||||||||||| START CONFIGURATION SECTION |||||||||||||||||||| # # -------------------- --------------------
# # # # the path to your PID file # PIDFILE=/private/var/run/httpd.pid # # # # the path to your httpd binary, including options if necessary # HTTPD=/usr/sbin/httpd # # <snip># +---------+---------+---------+---------+---------+--------- +---------+---------+
# ( 8 ) You should see "Syntax OK"# +---------+---------+---------+---------+---------+--------- +---------+---------+
[2007.30.06](11:48AM) -> [username] ~ $ sudo /opt/local/apache2/bin/httpd -S Password: VirtualHost configuration: 127.0.0.1:80 is a NameVirtualHostdefault server localhost (/WebServer/Documents/sites/ 0000_127.0.0.1_80_localhost.conf:11) port 80 namevhost localhost (/WebServer/Documents/sites/ 0000_127.0.0.1_80_localhost.conf:11)
127.0.0.1:443 is a NameVirtualHostdefault server localhost (/WebServer/Documents/sites/ 0005_127.0.0.1_443_localhost.conf:12) port 443 namevhost localhost (/WebServer/Documents/sites/ 0005_127.0.0.1_443_localhost.conf:12)
Syntax OK [2007.30.06](07:00PM) -> [username] ~ $ open /Applications/Utilities/Console.app# Check the permissions for the log file directories, pull up the console and check the logs
# # Hope this helps... # # Best regards, # # Bill Hernandez # Plano, Texas# +---------+---------+---------+---------+---------+--------- +---------+---------+ # ( 9 ) Here's a sample virtual host definition for localhost that requires # password authentication. It also shows the directories for the virtual hosts
## It refers to four different IMAGINARY domains that are hosted on a server. # www.marine-life.com was the only one taken so I used www.x-marine- life.com
# for the purposes of this example... # http://www.artic-wildlife.com # https://www.artic-wildlife.com # <Directory "/WebServer/Documents/sites/public/artic-wildlife.com/www"> # http://www.x-marine-life.com # https://www.x-marine-life.com # <Directory "/WebServer/Documents/sites/public/x-marine-life.com/www"> # http://www.prehistoric-animals.com # https://www.prehistoric-animals.com# <Directory "/WebServer/Documents/sites/public/prehistoric- animals.com/www">
# http://www.outstanding-pets.com # https://www.outstanding-pets.com# <Directory "/WebServer/Documents/sites/public/outstanding-pets.com/ www">
# # It's just a sample that works fine for a development machine# containing the same exact hierarchy on the server, so when you are doing # development you don't have to do it on the server, but you can test the
# results simulating the server environment...# +---------+---------+---------+---------+---------+--------- +---------+---------+
# Filename : /WebServer/Documents/sites/127.0.0.1_443_localhost.conf # Description : SSL Virtual Host Configuration # NOTE : name based virtual host (REQUIRES : both lines below) # NameVirtualHost *:443 # <VirtualHost *:443> # NOTE : IP based virtual host (USES : one of the two lines below) # <VirtualHost localhost:443> # <VirtualHost 127.0.0.1:443> <VirtualHost 127.0.0.1:443> ServerName localhost ServerAdmin admin@xxxxxxxxxxxxxxxxx DocumentRoot "/WebServer/Documents/sites/public" DirectoryIndex "dir_index.php" "index.php" "index.html" CustomLog "logs/access.log" "%h %l %u %t \"%r\" %>s %b" ErrorLog "logs/error.log"# CustomLog '|/usr/sbin/rotatelogs "logs/access.log" 2592000' "%h %l %u %t \"%r\" %>s %b"
# ErrorLog '|/usr/sbin/rotatelogs "logs/error.log" 2592000' ErrorDocument 404 /www_misc/error.html <IfModule mod_ssl.c> SSLEngine On # SSLLog "logs/ssl/ssl_engine.log" ErrorLog "logs/ssl/ssl_error.log" # NOTE : These self signed certificates work fine SSLCertificateFile "/WebServer/Documents/sites/certs/Default.crt" SSLCertificateKeyFile "/WebServer/Documents/sites/certs/Default.key" # NOTE : These work correctly with no passphrase# SSLCertificateFile "/WebServer/Documents/sites/certs/prehistoric- animals.crt.der" # SSLCertificateKeyFile "/WebServer/Documents/sites/certs/ prehistoric-animals.key.pem" # SSLCACertificateFile "/WebServer/Documents/sites/certs/ geotrust.cacrt"
SSLCipherSuite "ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:!SSLv2:+EXP: +eNULL"
</IfModule> <IfModule mod_dav.c> DAVLockDB "/var/run/davlocks/.davlockany_80_default" DAVMinTimeout 600 </IfModule> <Directory "/WebServer/Documents/sites/public"> Options All +Indexes -ExecCGI -Includes +MultiViews <IfModule mod_dav.c> # NOTE : This has to go here, in the DocumentRoot DAV Off </IfModule> AllowOverride None Order allow,deny Allow from all AuthName "Private - Main Realm" AuthType Basic AuthUserFile /WebServer/Documents/sites/realms/apache_users AuthGroupFile /WebServer/Documents/sites/realms/apache_groups<Limit GET HEAD OPTIONS CONNECT POST PROPFIND PUT DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
Require group admin_group sales_group </Limit> </Directory> <IfModule mod_rewrite.c> RewriteEngine On # NOTE : Instead of index.html, I use dir_index.php as a default # NOTE : This is probably redundant now that I created some aliases RewriteCond %{SERVER_PORT} 443 RewriteRule ^/(.*)/www/$ /$1/dir_index.php [L,R] RewriteRule ^/(.*)/www/(.*)$ /$1/$2 [L,R] # NOTE : STARTING WITH ^(http|https)://localhost DOES NOT WORK# RewriteRule ^(http|https)://localhost/(.*)/www/(.*)$ http:// localhost/$1/$2 [L,R]
RewriteCond %{REQUEST_METHOD} ^TRACE RewriteRule .* - [F] </IfModule> <IfModule mod_alias.c># NOTE : Keep items used by more than one site, i.e. common items, such as # NOTE : [styles, images, js, and shared items] outside the document root
# NOTE : in essence private (not directly accessible) to apache usersAlias "/base_styles/" "/WebServer/Documents/sites/private/ base_styles/" Alias "/base_images/" "/WebServer/Documents/sites/private/ base_images/" Alias "/base_javascript/" "/WebServer/Documents/sites/private/ base_javascript/" Alias "/shared_items/" "/WebServer/Documents/sites/public/ shared_items/" # +---------+---------+---------+---------+---------+--------- +---------+---------+ # NOTE : These allow access any one of the virtual hosts (via SSL from localhost) for test purposes
# NOTE : called as follows : http://localhost/vh1/whatever.html # NOTE : called as follows : https://localhost/vh1/whatever.htmlAlias "/vh1/" "/WebServer/Documents/sites/public/artic-wildlife.com/ www/" Alias "/vh2/" "/WebServer/Documents/sites/public/x-marine-life.com/ www/" Alias "/vh3/" "/WebServer/Documents/sites/public/prehistoric- animals.com/www/" Alias "/vh4/" "/WebServer/Documents/sites/public/outstanding- pets.com/www/" # +---------+---------+---------+---------+---------+--------- +---------+---------+ # NOTE : called as follows : http://localhost/artic-wildlife.com/ www/whatever.html # NOTE : called as follows : https://localhost/artic-wildlife.com/ www/whatever.html # NOTE : if you don't have this sometimes you run into a problem when using "+Indexes"
Alias "/artic-wildlife.com/www/" "/WebServer/Documents/sites/public/ artic-wildlife.com/www/" Alias "/x-marine-life.com/www/" "/WebServer/Documents/sites/public/ x-marine-life.com/www/" Alias "/prehistoric-animals.com/www/" "/WebServer/Documents/sites/ public/prehistoric-animals.com/www/" Alias "/outstanding-pets.com/www/" "/WebServer/Documents/sites/ public/outstanding-pets.com/www/" # +---------+---------+---------+---------+---------+--------- +---------+---------+ # NOTE : called as follows : http://localhost/artic-wildlife.com/ whatever.html
Alias "/artic-wildlife.com/" "/WebServer/Documents/sites/public/ artic-wildlife.com/www/" Alias "/x-marine-life.com/" "/WebServer/Documents/sites/public/x- marine-life.com/www/" Alias "/prehistoric-animals.com/" "/WebServer/Documents/sites/ public/prehistoric-animals.com/www/" Alias "/outstanding-pets.com/" "/WebServer/Documents/sites/public/ outstanding-pets.com/www/"
</IfModule># +---------+---------+---------+---------+---------+--------- +---------+---------+
# NOTE : allow localhost only access to images, etc...# NOTE : do the same thing for NON-localhost files, in the virtual host for artic-wildlife.com # NOTE : use SetEnvIfNoCase Referer "^(http|https)://artic- wildlife.com/" valid_request=1
SetEnvIfNoCase Referer "^(http|https)://localhost/" valid_request=1 <FilesMatch "\.(css|js|gif|jpg)"> Order Allow,Deny Allow from env=valid_request # Allow from all </FilesMatch># +---------+---------+---------+---------+---------+--------- +---------+---------+
LogLevel warn ServerAlias * </VirtualHost> --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx