Nginx proxying to Apache: what about mod_rewrite?
illarra
nginx-forum at nginx.us
Thu Oct 1 12:25:11 MSD 2009
This is how I solved it finally.
I use nginx for the domain redirect:
server {
listen 0.0.0.0:80;
server_name static.domain.com;
location / {
root /home/web/static/;
expires 40d;
add_header Cache-Control public;
}
}
server {
listen 0.0.0.0:80;
server_name domain.com www.domain.com;
if ( $host != 'domain.com' ) {
rewrite ^/(.*)$ http://domain.com/$1 permanent;
}
location / {
# mod_rewrite in apache
proxy_pass http://127.0.0.1:8030;
}
}
And the real rewrite is in Apache.
As this domain only deals with dynamic content, I can do it this way:
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /home/www
Options -Indexes IncludesNOEXEC FollowSymLinks -MultiViews
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine On
RewriteRule ^(.*)$ /index.php$1?%{QUERY_STRING}
Thanks for your help!
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,10271,10433#msg-10433
More information about the nginx
mailing list