You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Feng He <fe...@nsbeta.info> on 2012/12/19 09:40:13 UTC

alias command in modperl environment

Hello,

<VirtualHost *:80>
         ServerAdmin xxx@yyy.com
         ServerName example.com

         PerlModule Apache::DBI
         PerlPostConfigRequire /path/to/startup.pl

         <Location />
             SetHandler modperl
             PerlResponseHandler Handler1
         </Location>

         <Location /ip/>
             SetHandler modperl
             PerlResponseHandler Handler2
         </Location>

         Alias /zzz/ "/var/www/zzz/"
         <Directory /var/www/zzz/>
                 Options FollowSymLinks MultiViews
                 AllowOverride None
                 Order allow,deny
                 allow from all
         </Directory>

         ErrorLog /var/log/apache2/error.log
         LogLevel warn
         CustomLog /var/log/apache2/cdn.access.log combined

</VirtualHost>


I put some static files under /var/www/zzz/.
When accessing these static files, I got 403 error.
Can't alias command work for this case?

Thanks.

Re: alias command in modperl environment

Posted by Feng He <fe...@nsbeta.info>.
Thanks a lot.


于 2012-12-19 23:02, Andy Colson 写道:
> On 12/19/2012 2:40 AM, Feng He wrote:
>> Hello,
>>
>> <VirtualHost *:80>
>>          ServerAdmin xxx@yyy.com
>>          ServerName example.com
>>
>>          PerlModule Apache::DBI
>>          PerlPostConfigRequire /path/to/startup.pl
>>
>>          <Location />
>>              SetHandler modperl
>>              PerlResponseHandler Handler1
>>          </Location>
>>
>>          <Location /ip/>
>>              SetHandler modperl
>>              PerlResponseHandler Handler2
>>          </Location>
>>
>>          Alias /zzz/ "/var/www/zzz/"
>>          <Directory /var/www/zzz/>
>>                  Options FollowSymLinks MultiViews
>>                  AllowOverride None
>>                  Order allow,deny
>>                  allow from all
>>          </Directory>
>>
>>          ErrorLog /var/log/apache2/error.log
>>          LogLevel warn
>>          CustomLog /var/log/apache2/cdn.access.log combined
>>
>> </VirtualHost>
>>
>>
>> I put some static files under /var/www/zzz/.
>> When accessing these static files, I got 403 error.
>> Can't alias command work for this case?
>>
>> Thanks.
>
> Here is an apache config I use that works:
>
> PerlSwitches -I "/pub/www/world"
> PerlModule World
>
> <Location /world>
>          PerlSetupEnv Off
>          SetHandler modperl
>          PerlResponseHandler World
>          Order allow,deny
>          Allow from all
> </Location>
>
> <Location /world/css>
>          SetHandler default-handler
>          Allow from all
> </Location>
>
> <Location /world/js>
>          SetHandler default-handler
>          Allow from all
> </Location>
>
> Alias /world/css /pub/www/world/css
> Alias /world/js /pub/www/world/js
>
>
> -Andy


Re: alias command in modperl environment

Posted by Andy Colson <an...@squeakycode.net>.
On 12/19/2012 2:40 AM, Feng He wrote:
> Hello,
>
> <VirtualHost *:80>
>          ServerAdmin xxx@yyy.com
>          ServerName example.com
>
>          PerlModule Apache::DBI
>          PerlPostConfigRequire /path/to/startup.pl
>
>          <Location />
>              SetHandler modperl
>              PerlResponseHandler Handler1
>          </Location>
>
>          <Location /ip/>
>              SetHandler modperl
>              PerlResponseHandler Handler2
>          </Location>
>
>          Alias /zzz/ "/var/www/zzz/"
>          <Directory /var/www/zzz/>
>                  Options FollowSymLinks MultiViews
>                  AllowOverride None
>                  Order allow,deny
>                  allow from all
>          </Directory>
>
>          ErrorLog /var/log/apache2/error.log
>          LogLevel warn
>          CustomLog /var/log/apache2/cdn.access.log combined
>
> </VirtualHost>
>
>
> I put some static files under /var/www/zzz/.
> When accessing these static files, I got 403 error.
> Can't alias command work for this case?
>
> Thanks.

Here is an apache config I use that works:

PerlSwitches -I "/pub/www/world"
PerlModule World

<Location /world>
         PerlSetupEnv Off
         SetHandler modperl
         PerlResponseHandler World
         Order allow,deny
         Allow from all
</Location>

<Location /world/css>
         SetHandler default-handler
         Allow from all
</Location>

<Location /world/js>
         SetHandler default-handler
         Allow from all
</Location>

Alias /world/css /pub/www/world/css
Alias /world/js /pub/www/world/js


-Andy

Re: alias command in modperl environment

Posted by André Warnier <aw...@ice-sa.com>.
Feng He wrote:
> Hello,
> 
> <VirtualHost *:80>
>         ServerAdmin xxx@yyy.com
>         ServerName example.com
> 
>         PerlModule Apache::DBI
>         PerlPostConfigRequire /path/to/startup.pl
> 
>         <Location />
>             SetHandler modperl
>             PerlResponseHandler Handler1
>         </Location>
> 
>         <Location /ip/>
>             SetHandler modperl
>             PerlResponseHandler Handler2
>         </Location>
> 
>         Alias /zzz/ "/var/www/zzz/"
>         <Directory /var/www/zzz/>
>                 Options FollowSymLinks MultiViews
>                 AllowOverride None
>                 Order allow,deny
>                 allow from all
>         </Directory>
> 
>         ErrorLog /var/log/apache2/error.log
>         LogLevel warn
>         CustomLog /var/log/apache2/cdn.access.log combined
> 
> </VirtualHost>
> 
> 
> I put some static files under /var/www/zzz/.
> When accessing these static files, I got 403 error.
> Can't alias command work for this case?
> 

I believe that you have the following problem :

What you specify in the "<Location />", by default, is inherited by all "sub-Locations" of 
"/", so for example the location "/zzz/" inherits the "SetHandler modperl" from the 
location "/".
I don't remember the exact syntax, but try to add the following :

<Location "/zzz/">
   SetHandler default       (or maybe it is "none")
   .. (other directives)
</Location>

Generally, I try to avoid setting a special handler or other special rules for the 
Location "/", for precisely that kind of reason : you find that you then need to override 
these defaults in every sub-directory of your setup.

Re: alias command in modperl environment

Posted by Jie Gao <J....@sydney.edu.au>.
Raise loglevel to debug and see what you get in the log then. -Jie

* Feng He <fe...@nsbeta.info> wrote:

> Date: Wed, 19 Dec 2012 17:05:20 +0800
> From: Feng He <fe...@nsbeta.info>
> To: Jie Gao <J....@sydney.edu.au>
> CC: modperl@perl.apache.org
> Subject: Re: alias command in modperl environment
> User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0
>  Thunderbird/17.0
> 
> 于 2012-12-19 16:47, Jie Gao 写道:
> >What's the error message in your errlog.log?
> 
> it simply said access reject.

Re: alias command in modperl environment

Posted by Feng He <fe...@nsbeta.info>.
于 2012-12-19 16:47, Jie Gao 写道:
> What's the error message in your errlog.log?

it simply said access reject.

Re: alias command in modperl environment

Posted by Jie Gao <J....@sydney.edu.au>.
What's the error message in your errlog.log?


-Jie 


Please think of our environment and only print this e-mail if necessary.

* Feng He <fe...@nsbeta.info> wrote:

> Date: Wed, 19 Dec 2012 16:40:13 +0800
> From: Feng He <fe...@nsbeta.info>
> To: modperl@perl.apache.org
> Subject: alias command in modperl environment
> User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0
>  Thunderbird/17.0
> 
> Hello,
> 
> <VirtualHost *:80>
>         ServerAdmin xxx@yyy.com
>         ServerName example.com
> 
>         PerlModule Apache::DBI
>         PerlPostConfigRequire /path/to/startup.pl
> 
>         <Location />
>             SetHandler modperl
>             PerlResponseHandler Handler1
>         </Location>
> 
>         <Location /ip/>
>             SetHandler modperl
>             PerlResponseHandler Handler2
>         </Location>
> 
>         Alias /zzz/ "/var/www/zzz/"
>         <Directory /var/www/zzz/>
>                 Options FollowSymLinks MultiViews
>                 AllowOverride None
>                 Order allow,deny
>                 allow from all
>         </Directory>
> 
>         ErrorLog /var/log/apache2/error.log
>         LogLevel warn
>         CustomLog /var/log/apache2/cdn.access.log combined
> 
> </VirtualHost>
> 
> 
> I put some static files under /var/www/zzz/.
> When accessing these static files, I got 403 error.
> Can't alias command work for this case?
> 
> Thanks.