rewrite question - magento in subfolder

liamstask nginx-forum at
Thu Jan 21 11:05:35 MSK 2010

I've just started trying to get a site of mine switched over to nginx, and have enjoyed it so far but I've come up against a rewrite issue I haven't been able to solve easily.  We're running an instance of magento at the location  I've followed the nice example at, although I haven't been able to adjust it to work in a subfolder.  

I've tried to modify the main location directive, such that it looks like
    location /magento {
      rewrite /magento(/index.php)?(.*) /$1 break;
      include /etc/nginx/fastcgi_params;
      fastcgi_param  SCRIPT_FILENAME /home/webapps/magento/index.php$1;

as well as a few variations on that, but with debug output on I've seen that it only seems to modify the document_uri, not the request_uri, such that document_uri is "/" while request_uri remains "/magento".  I realize I must be missing something simple, but can anybody give any pointers on how to remove the leading "/magento" from the request_uri as well?

nginx 0.7.64, ubuntu 9.10

Posted at Nginx Forum:,43760,43760#msg-43760

More information about the nginx mailing list