cgi-bin and virtual hosts

Discussion in 'HTML & Website Design' started by jaymax, Dec 14, 2009.

  1. #1
    I have an Apache Server v 2.2.11 running on a FreeBSD platform OS/7.2 w/ one NIC Card and hence one IP #.

    Now, I have several virtual hosts running, two types -
    (1) as a subdomain ex. vhost1.domain.com, ... vhost99999.domain.com and
    (2) others with their own registered domain as vhost-a.com ... vhost-z.com

    all of these have this in their virtual host directive
    <IfModule alias_module>
    ScriptAlias /cgi-bin/ /usr/local/www/apache22/cgi-bin
    </IfModule>
    and similarly lines in the main httpd.conf file.

    The problem is that only the default domain.com/cgi-bin seems to works, using printenv or test-cgi

    Could someone advise?


    Thanks!
     
    jaymax, Dec 14, 2009 IP
  2. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Are the other virtual domains being set to the root as their base first?

    Are you doing redirects or rewrites?

    http://httpd.apache.org/docs/2.2/mod/mod_alias.html

    Script Alias acts the same as Alias.

    BTW do you know for sure if you have alias_module? Because if you do, you're totally wasting cycles with that <IfModule> stuff. Don't make Apache check to see IF the module exists Every Single Time. This is your server, IFModule is for people who don't have any control of their servers. It's a penalty you don't need.

    BTW I've just reached the limits of my Apache knowledge, lawlz. But I suspect your answer does lie with the order of how alias is processed, and seems to make sense with your symptoms.
     
    Stomme poes, Dec 15, 2009 IP
  3. jaymax

    jaymax Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi Stommes, thanks for your reply,
    There are no redirects or rewrites
    Here is my complete virtual host directive

    <VirtualHost *:80>
    ServerAdmin webmaster@xxxxxxx.com
    DocumentRoot "/usr/local/www/apache22/subdomain/"
    ServerName subdomain.xxxxxxx.com
    ServerAlias www.subdomain.xxxxxxx.com


    <Directory "/usr/local/www/apache22/subdomain/">
    Options Indexes FollowSymLinks

    AllowOverride None
    Order allow,deny
    Allow from all

    </Directory>

    # CGI Directory

    <Location /cgi-bin>
    Options +ExecCGI
    </Location>

    ScriptAlias /cgi-bin/ /usr/local/www/apache22/cgi-bin

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

    </FilesMatch>
    ErrorLog "/var/log/subdomain-error_log"
    CustomLog "/var/log/subdomain-access_log" common
    </VirtualHost>
     
    jaymax, Dec 15, 2009 IP