atom feed2 messages in ru.sysoev.nginxRe: Nginx as Apache proxy for static ...
FromSent OnAttachments
Genko PenevNov 20, 2009 5:47 am 
Sean AllenNov 21, 2009 1:55 pm 
Subject:Re: Nginx as Apache proxy for static content
From:Sean Allen (se@monkeysnatchbanana.com)
Date:Nov 21, 2009 1:55:32 pm
List:ru.sysoev.nginx

try

location ~* \.(php|phtm|phtml)$

or

location ~* \.(php|phtm(l)?)$

2009/11/20 Genko Penev <genk@gmail.com>

Hello,

I installed Nginx. Set up as a server for static content and a dynamic content to be redirected to a Apache server behind. Everything works fine, server load decreased. I began to serving three times more requests. Glad that everything worked, but the beam. Rewrite rules don't work. Here is my configuration of Nginx in /etc/nginx/conf.d/virtual.conf:

#virtual hosts start #start - _default_ server { listen 80; server_name _default_ alias._default_;

location ~* (/|.php|.phtm|.phtml)$ { proxy_pass http://127.0.0.1:8080; proxy_redirect off;

proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 128m;

proxy_connect_timeout 60; proxy_send_timeout 60; proxy_read_timeout 60; } location / { root /var/www; } } #end - _default_

#start - secretsexpartner.com server { listen 80; server_name secretsexpartner.com www.secretsexpartner.com alias.secretsexpartner.com;

location ~* (/|.php|.phtm|.phtml)$ { proxy_pass http://127.0.0.1:8080; proxy_redirect off;

proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 128m;

proxy_connect_timeout 60; proxy_send_timeout 60; proxy_read_timeout 60; }

location / { root /var//www; } } #end - secretsexpartner.com #virtual hosts end

I use following .htaccess file on apache root directory:

RewriteEngine on Options +FollowSymlinks RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ navigation.php

RewriteRule .* - [E=HTTP_X_REQUESTED_WITH:%{HTTP:X-Requested-With}]

And when try to access web pages that use this rules, nginx tell me Page not found 404. How to implement this .htaccess to work and with Nginx frontend.

Thanks in advance!