Re: Simple URI redirection / alias in Nginx…
Igor Sysoev
igor at sysoev.ru
Mon May 30 22:47:10 MSD 2011
On Mon, May 30, 2011 at 09:40:09AM -0400, atipico wrote:
> Please, how can I make this simple operation:
>
> I wish that every requests for uris like:
> http://example.com/adm
> or:
> http://example.com/adm
> Goes to the wordpress login page:
> wordpress/wp-login.php
> (The wordpress installation is inside the folder "wordpress").
>
> I've tried:
>
> location /adm/ { alias wordpress/wp-login.php; }
> location /adm { alias wordpress/wp-login.php; }
>
> and:
>
> rewrite ^/adm$ wordpress/wp-login.php;
>
> But with no success...
>
> Just in case someone asks, this is my serve conf. file:
>
> server {
> server_name www.example.com;
> rewrite ^ http://example.com$request_uri? permanent;
> }
>
> server {
> server_name example.com;
>
> access_log /var/log/nginx/example.com.access;
> error_log /var/log/nginx/example.com.error;
>
> root /var/www/example.com;
>
> index index.htm index.php;
>
> location / {try_files $uri /wp$uri/ /wordpress/index.php$args;}
>
> location ~ .php$ {
> try_files $uri =404;
> #fastcgi_split_path_info ^(.+\.php)(/.+)$;
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> include /etc/nginx/fastcgi_params;
> }
>
> location = /favicon.ico {log_not_found off;access_log off;}
> location = /robots.txt {allow all;log_not_found off;access_log off;}
> location ~ /\. {deny all;access_log off;log_not_found off; }
> }
location = /adm/ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/example.com/wordpress/wp-login.php
include /etc/nginx/fastcgi_params;
}
location = /adm {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/example.com/wordpress/wp-login.php
include /etc/nginx/fastcgi_params;
}
--
Igor Sysoev
More information about the nginx
mailing list