Alias which works like in other web servers
Igor Sysoev
is at rambler-co.ru
Fri Aug 3 15:46:22 MSD 2007
On Fri, Aug 03, 2007 at 11:18:51AM +0100, Just Marc wrote:
> I have a website and a wordpress blog under /blog/ The blog scripts
> are sitting in a different directory, this is the conf:
>
> server {
> listen x.x.x.x;
> root /var/www/site/;
>
> location /blog {
> alias /var/www/wordpress;
>
> rewrite ^.+?(/.*\.php)$ $1 last;
> rewrite ^ /index.php last;
> }
>
> location / {
> rewrite '^/([^\.]*)\.html$' /index.php?p=$1 last;
> }
>
> location ~ .php$ {
> fastcgi_pass 10.0.0.1:1026;
> fastcgi_index index.php;
> include conf/fastcgi.conf;
> }
>
> With this conf, a request to: /blog/wp-login.php is processed by the php
> location resulting in a bad URL (nginx tries to open:
> /var/www/site/blog/wp-login.php).
>
> I tried a few things such as putting the fastcgi statements inside every
> location {} and while that works, it produces bad results as every
> request within that location gets passed to fastcgi, including images, etc.
>
> I found this thread
> http://thread.gmane.org/gmane.comp.web.nginx.english/188/focus=189 but
> unfortunately it was not answered.
>
> Basically I'm looking to do a 'simple' Alias like in apache or
> lighttpd. How can I do this?
The "alias" is this simple command.
The "/blog/wp-login.php" is handled in "location ~ .php$".
You probably need:
location ^~ /blog {
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list