Hi Randy,

> apache has been restarted. nothing in the site.include and the container
> looks simple and clean. send me what your vhost to compare.

Here is my Vhost container which works. The site has "web alias redirects" 
ticked. But I also tested it with that checkbox unticked, in which case 
additional "RewriteCond %{HTTP_HOST}" lines will be added for each web alias.

Additionally this site has PHP and suPHP, CGI and SSI enabled.

-----------------------------------------------------------------------------------------------------------------
[root@5108r BlueOnyx]# cat /etc/httpd/conf/vhosts/site3
# owned by VirtualHost
NameVirtualHost 192.168.8.129:80

# FrontPage needs the following four things to be here
# otherwise all the vhosts need to go in httpd.conf, which could
# get very large since there could be thousands of vhosts
ServerRoot /etc/httpd

<VirtualHost 192.168.8.129:80>
ServerName www.company.com
ServerAlias company.com
ServerAdmin admin
DocumentRoot /home/.sites/106/site3/web
ErrorDocument 401 /error/401-authorization.html
ErrorDocument 403 /error/403-forbidden.html
ErrorDocument 404 /error/404-file-not-found.html
ErrorDocument 500 /error/500-internal-server-error.html
RewriteEngine on
RewriteCond %{HTTP_HOST}                !^192.168.8.129(:80)?$
RewriteCond %{HTTP_HOST}                !^www.company.com(:80)?$ [NC]

RewriteRule ^/(.*)                      http://www.company.com/$1 [L,R=301]

RewriteOptions inherit
#AliasMatch ^/~([^/]+)(/(.*))?          /home/.sites/106/site3/users/$1/web/$3
Include /etc/httpd/conf/vhosts/site3.include
# BEGIN Bandwidth SECTION.  DO NOT EDIT MARKS OR IN BETWEEN.
# END Bandwidth SECTION.  DO NOT EDIT MARKS OR IN BETWEEN.
# BEGIN WebScripting SECTION.  DO NOT EDIT MARKS OR IN BETWEEN.
AddHandler cgi-wrapper .cgi
AddHandler cgi-wrapper .pl
AddHandler server-parsed .shtml
AddType text/html .shtml
suPHP_Engine on
suPHP_ConfigPath /home/sites/www.company.com
suPHP_AddHandler x-httpd-suphp
AddHandler x-httpd-suphp .php
# END WebScripting SECTION.  DO NOT EDIT MARKS OR IN BETWEEN.
# BEGIN PHP SECTION.  DO NOT EDIT MARKS OR IN BETWEEN.
php_admin_flag register_globals Off
php_admin_flag allow_url_fopen Off
php_admin_flag allow_url_include Off
php_admin_value open_basedir 
/tmp/:/var/lib/php/session/:/usr/sausalito/configs/php/:/home/.sites/106/site3/
php_admin_value post_max_size 8M
php_admin_value upload_max_filesize 5M
php_admin_value max_execution_time 30
php_admin_value max_input_time 60
php_admin_value memory_limit 64M
php_admin_flag mail.add_x_header On
php_admin_value sendmail_path /usr/sausalito/sbin/phpsendmail
php_admin_value auto_prepend_file 
/usr/sausalito/configs/php/set_php_headers.php
# END PHP SECTION.  DO NOT EDIT MARKS OR IN BETWEEN.
</VirtualHost>
# end of VirtualHost owned section
-----------------------------------------------------------------------------------------------------------------

Also, for debugging purpose create this file: /etc/DEBUG

Using "touch /etc/DEBUG" will do. The file doesn't have to have anything in 
it.

Then restart Apache from the command line and watch the extra debugging output 
on the console.

It will show something like this:

-----------------------------------------------------------------------------------------------------------------
[root@5108r BlueOnyx]# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: $VAR1 = '192.168.8.129:443';
$VAR2 = {
          'php_admin_value auto_prepend_file 
/usr/sausalito/configs/php/set_php_headers.php
' => '',
          'php_admin_value max_input_time 60
' => '',
          'php_admin_value memory_limit 64M
' => '',
          'suPHP_Engine on
' => '',
          'ErrorDocument 404 /error/404-file-not-found.html
' => '',
          'SSLengine' => 'on',
          'php_admin_flag allow_url_include Off
' => '',
          'php_admin_flag register_globals Off
' => '',
          'ErrorDocument 403 /error/403-forbidden.html
' => '',
          'php_admin_flag mail.add_x_header On
' => '',
          'ServerAdmin admin
' => '',
          'AddHandler cgi-wrapper .cgi
' => '',
          'ServerName www.company.com
' => '',
          'php_admin_value post_max_size 8M
' => '',
          'php_admin_value upload_max_filesize 5M
' => '',
          'Include /etc/httpd/conf/vhosts/site3.include
' => '',
          'suPHP_ConfigPath /home/sites/www.company.com
' => '',
          'DocumentRoot /home/.sites/106/site3/web
' => '',
          'suPHP_AddHandler x-httpd-suphp
' => '',
          'ServerAlias company.com
' => '',
          'SSLCertificateFile' => '/home/.sites/106/site3/certs/certificate',
          'php_admin_value sendmail_path /usr/sausalito/sbin/phpsendmail
' => '',
          'ErrorDocument 500 /error/500-internal-server-error.html
' => '',
          'php_admin_value max_execution_time 30
' => '',
          'ErrorDocument 401 /error/401-authorization.html
' => '',
          'RewriteCond %{HTTP_HOST}                !^www.company.com(:443)?$ 
[NC]
' => '',
          'AddType text/html .shtml
' => '',
          'AddHandler server-parsed .shtml
' => '',
          'RewriteRule ^/(.*)                      
https://www.company.com:443/$1 [L,R=301]
' => '',
          'AddHandler cgi-wrapper .pl
' => '',
          'RewriteCond %{HTTP_HOST}                !^192.168.8.129(:443)?$
' => '',
          'php_admin_flag allow_url_fopen Off
' => '',
          'AddHandler x-httpd-suphp .php
' => '',
          'RewriteEngine on
' => '',
          'php_admin_value open_basedir 
/tmp/:/var/lib/php/session/:/usr/sausalito/configs/php/:/home/.sites/106/site3/
' => '',
          'RewriteOptions inherit
' => '',
          'SSLCertificateKeyFile' => '/home/.sites/106/site3/certs/key'
        };
1;
__END__
[Fri Apr 27 22:32:35 2012] [warn] NameVirtualHost 192.168.8.129:80 has no 
VirtualHosts
[Fri Apr 27 22:32:35 2012] [warn] NameVirtualHost 192.168.8.129:80 has no 
VirtualHosts
[Fri Apr 27 22:32:35 2012] [warn] NameVirtualHost 192.168.8.129:80 has no 
VirtualHosts
                                                           [  OK  ]

-----------------------------------------------------------------------------------------------------------------

These are the dynamic replacements of the Apache config that 
/etc/httpd/conf.d/ssl_perl.conf does for SSL enabled sites to dynamically 
generate the SSL ready Vhost container.

Essentially it changes just duplicates the entire Vhost container of a given 
site and replaces port 80 with 443 wherever applicable and replaces "http" 
with "https" for the "RewriteRule". So typically the following three lines 
inside such a container will be different:

-----------------------------------------------------------------------------------------------------------------
'RewriteCond %{HTTP_HOST}                !^www.company.com(:443)?$ [NC]
'RewriteRule ^/(.*)              https://www.company.com:443/$1 [L,R=301]
'RewriteCond %{HTTP_HOST}                !^192.168.8.129(:443)?$
-----------------------------------------------------------------------------------------------------------------


-- 
With best regards

Michael Stauber
_______________________________________________
Blueonyx mailing list
Blueonyx@mail.blueonyx.it
http://mail.blueonyx.it/mailman/listinfo/blueonyx

Reply via email to