the alias don't show

Maxim Dounin mdounin at mdounin.ru
Sun Apr 4 01:33:59 MSD 2010


Hello!

On Sat, Apr 03, 2010 at 12:10:05PM -0400, Michel Vega Fuenzalida wrote:

> Hi list, sorry my english.
> 
> I can show .php files, with this configuration in the file
> www.misito.cu in /etc/nginx/site-enable/:
> server {
>    listen   www.miserver.cu:80;
>    server_name www.misito.cu;
>    access_log /var/log/nginx/access-miserver.log;
>    error_log /var/log/nginx/error-miserver.log;
> 
>    location / {
>        root /var/www/test;
>        index index.php;
>    }
> 
>    location ~ \.php$ {
>        include /etc/nginx/fastcgi_params;
>        fastcgi_pass  127.0.0.1:9000;
>        fastcgi_index index.php;
>       fastcgi_param  SCRIPT_FILENAME  /var/www/test$fastcgi_script_name;
>    }
> }
> 
> I like show the Web Site that is in /home/pepe/SCJM/, that have like
> index file: index.php, all this Site is in .php file, when I add
> that at the file www.misitio.cu:
>  location /SCJM {
>        root /home/michelvf;
>        index index.php;
>  }
> 
> the browser:  http://www.misitio.cu/SCJM/,  show this text:
> No input file specified.
> 
> Bat when I do that:
> cd /var/www/test/
> ln -s /home/pepe/SCJM
> 
> the browser yes show the Web Site.
> 
> Who I cant show the Site in /home/pepe/SCJM that have file .php
> using the location directive?

You have to tell nginx that php files under /SCJM should be 
processed under /home/michelvf.  Note that for regexp locations 
order matters, so it should be specified before generic .php 
location.  I.e. you should write something like this:

    location / {
        root /var/www/test;
        ...
    }

    location /SCJM {
        root /home/michelvf;
        ...
    }

    location ~ ^/SCJM/.*\.php$ {
        fastcgi_pass ...
        fastcgi_param SCRIPT_FILENAME /home/michelvf$fastcgi_script_name;
        ...
    }

    location ~ \.php$ {
        fastcgi_pass ..
        fastcgi_param SCRIPT_FILENAME /var/www/test$fastcgi_script_name;
        ...
    }

Maxim Dounin



More information about the nginx mailing list