[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Problem with sub-domain and cgi scripts



I'm a newbe sothat don't 'buy' this tip without asking someone who realy knows about the story. Here what I did on a RaQ550:

Name conventions:
Config file of the 'master' vsite is 'site33' as /etc/httpd/conf/vhosts/site33
Config file of the 'slave' vsite is 'site33.1' as /etc/httpd/conf/vhosts/site33.1

The Idee:
Don't touch rewrite, don't add "ServerAlias" (except for aliasing a domain that has nothing to do with the 'slave' site). Make another virtual host config file for slave site, and include it in 'master' site config. In that new file, change all domain references to the slave host.domain name.

Changes:
1) Remove server aliases in site33
2) Copy site33 to site33.1
3) Replace all host.domain references of 'master' site whith the 'slave' host.domain name in site33.1 file
4) Add "Inlclude /etc/httpd/conf/vhosts/site33.1" at the end of site33 file
5) Restarts apache

Hope that help (and hope also someone tell us if this is an half (or completly) wrong way of doing it).

Bertrand


At 17:31 15-04-2003, Richard Kurth wrote:



I have created sub-domains on my server buy adding a second
file called subdomain.conf in this file I have added the
sub-domain like the example at the bottom of this email and also set the DNS up to make this
all work. The sub-domain work just fine like this.
But when I add a CGI script or an ASP script they do not what to work.
You get a file can't be found error. It is look for the CGI file in the main
web directory for the main site.
Below is a little bit of the env of what is going on
You can see with the SCRIPT_FILENAME it is looking for the script in
the wrong directory it should be looking in
/home/sites/home/web/sub_domains/runwith.domain.com/web
not /home/sites/home/web/
I had to add the script to /home/sites/home/web/ to get it to work

The question is how can I make it run the scripts inside the
sub_domain???

REDIRECT_SCRIPT_URI="http://runwith.domain.com/printenv.cgi";
REDIRECT_SCRIPT_URL="/printenv.cgi"
SCRIPT_FILENAME="/home/sites/home/web/printenv.cgi"
SCRIPT_NAME="/printenv.cgi"
SCRIPT_URI="http://runwith.domain.com/printenv.cgi";

<VirtualHost 222.111.222.111>
ServerName runwith.domain.com
ServerAdmin rkurth
DocumentRoot /home/sites/home/web/sub_domains/runwith.domain.com/web
RewriteEngine on
RewriteCond %{HTTP_HOST}    !^222.111.222.111(:80)?$
RewriteCond %{HTTP_HOST}    !^runwith.domain.com(:80)?$
RewriteRule ^/(.*)    http://runwith.domain.com/$1 [L,R]
RewriteOptions inherit
AddHandler cgi-wrapper .cgi
AddHandler cgi-wrapper .pl
AddHandler server-parsed .shtml
AddType text/html .shtml
AddType application/x-httpd-php .php4 .php3
AddType application/x-httpd-php .php
</VirtualHost>