Nginx as Apache proxy for static content
Sean Allen
sean at monkeysnatchbanana.com
Sun Nov 22 00:55:55 MSK 2009
try
location ~* \.(php|phtm|phtml)$
or
location ~* \.(php|phtm(l)?)$
2009/11/20 Genko Penev <genkopenev at 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!
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20091121/afd51bc6/attachment.html>
More information about the nginx
mailing list