what's the simplest way to serve php files through an alias?
António P. P. Almeida
appa at perusio.net
Sun Oct 3 03:23:53 MSD 2010
On 3 Out 2010 00h05 WEST, iberkner at gmail.com wrote:
> we have a very simple configuration.
>
> server block with location block
>
> php is served through fastcgi and works fine
>
> would like to add something like this:
>
> location /nameofalias/
> {
> alias /usr/local/nameofalias;
> }
This is now how alias is supposed to be used. In fact you're using
alias like a root directive. Using alias is for when you want to use a
certain base directory and don't want the URI to reflect that.
location /foo {
alias /var/www/nginx-default/barz;
}
Request for /foo/xpto.png is translated to
/var/www/nginx-default/barz/xpto.png
> but it does not seem to work, static files load fine.
> the php location block is like this and works fine for the main
> location block of "location /"
>
> location ~ .php$
> {
> include fcgi;
> fastcgi_pass 127.0.0.1:9000;
> }
You should have a fastcgi_pass directive where you want the PHP files
to be handled.
Also you need to escape the "." as in
location ~ \.php$ {
(...)
}
--- appa
More information about the nginx
mailing list