Nginx proxying to Apache: what about mod_rewrite?

illarra nginx-forum at nginx.us
Wed Sep 30 21:01:47 MSD 2009


Hi!

I have a website running on a Nginx + Apache configuration.
Nginx serves the static content (in a different domain) and proxies directly to Apache, where all the PHP is executed.

The problem is that my app uses mod_rewrite, and I can't find where I have to put the rules.

This is a snippet of nginx.conf...

server {
    listen 0.0.0.0:80;
    server_name domain.com;
    location / {
        proxy_pass http://127.0.0.1:8030;
    }
}


And the Apache configuration...


ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /home/www

    Options -Indexes IncludesNOEXEC FollowSymLinks -MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all




The rewrite rule in Apache was this one, and it worked before I created the Nginx + Apache configuration.

RewriteRule ^(.*)$ index.php?r=$1?%{QUERY_STRING} 


The question is, where should I put the rewrite condition? in Nginx (adapted, of course) or Apache?

Thanks for having a look!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,10271,10271#msg-10271






More information about the nginx mailing list