Alias which works like in other web servers

Just Marc marc at corky.net
Fri Aug 3 14:18:51 MSD 2007


Hi,

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?

Thanks!
Marc






More information about the nginx mailing list