Rewrite help when files do NOT have a ".php" extension

As far as why goes, I find this blog post pretty good :
http://www.ichilton.co.uk/blog/web/nginx-and-why-you-should-be-running-it-instead-of-or-at-least-in-front-of-apache-380.html

But I would not call that a description of the architecture in deep.
I don’t think there is such a thing, but the closest things I can think
of are:

Happy digging,

A.


In for a ride in nginx-land ? Visit: http://www.nginx-discovery.com

Sorry I was not clear.

Yes I reran the ./configure --with-debug among other things, and then
make and make install.

Yes I only want to debug connections from that one IP, my IP. But even
that is not working.

The box is already a dev box. No one else is connecting to this server
yet, as it’s running on a non-80 port. Is there another way to debug?

Posted at Nginx Forum:

pk899 Wrote:

any idea why? why does just port change lead to
this?

thanks

in my error log i am seeing messages like this:

2011/06/03 14:32:07 [error] 21125#0: *1768 connect() failed (111:
Connection refused) while connecting to upstream, client: 216.248.232.5,
server: MYDOMAIN.com, request: “GET /itsurvey HTTP/1.1”, upstream:
http://77.12.16.8:8081/itsurvey”, host: “MYDOMAIN.com

why is “upstream” connection being “refused”? and how is “upstream”
different from “proxy”?

thanks for any ideas or advice.

Posted at Nginx Forum:

On 3 Jun 2011 19h40 WEST, [email protected] wrote:

different from “proxy”?
It’s the same thing. It’s your upstream, for which nginx is acting as
reverse proxy. Proxying request for scripts to Apache.

thanks for any ideas or advice.

Check your Apache config. Paste your nginx config somewhere so that we
can help you.

— appa

i managed to get it all installed, but the php-fpm and “location” stuff
is just too difficult for now. will deal with that later.

right now, at least to gain from nginx serving static files and some
bits of proxy_cache, i did this:

  1. setup nginx on port 81
  2. left apache on 80 (as my site is live)

this worked. proxying was happening etc.

then, to make it live, i did this:

  1. moved apache to 8081
  2. moved nginx to 80
  3. restarted both, first apache, then nginx

but now, with nginx being my front server, i just get 404 file not
found.

any idea why? why does just port change lead to this?

thanks

Posted at Nginx Forum:

Thanks appa.

My question is: if the setup works with two ports, how come it stops
working when the ports are switched?

Anyway, my config:

proxy_cache_path /dev/shm/proxy_cache levels=1:2
keys_zone=proxyone:10m inactive=10m max_size=100m;
proxy_cache_key “$scheme$host$request_uri$cookie___user”;

proxy_cache proxyone;
proxy_cache_min_uses 1;
proxy_cache_valid any 60s;
proxy_cache_valid 404 0s;
proxy_cache_valid 500 502 503 504 1s;

#>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SERVER BLOCK

server
{
listen 77.12.16.8:89;
server_name mydomain.com www.mydomain.com;

root /home/mydomain/public_html;
index index index.php index.html;

error_page 403 = @backend;
error_page 404 = @backend;
error_page 406 = @backend;
error_page 500 = @backend;

location / {
  location

~.*.(gif|jpg|png|ico|swf|rss|xml|htm|txt|js|css|gz|doc|xls|pdf)$ {
expires max;
try_files $uri @backend;
log_not_found off;
}
proxy_pass http://77.12.16.8:80;
include proxy.inc;
}

location @backend {
  internal;
  proxy_pass http://77.12.16.8:80;
  include proxy.inc;
}

} # End of server block

And in Apache:

RPAF STUFF FOR NGINX PROXYING

LoadModule rpaf_module modules/mod_rpaf-2.0.so
RPAFenable On
RPAFproxy_ips 127.0.0.1 77.12.16.8
RPAFsethostname On
RPAFheader X-Real-IP

Posted at Nginx Forum:

On 4 Jun 2011 05h26 WEST, [email protected] wrote:

proxy_cache_key “$scheme$host$request_uri$cookie___user”;
server
error_page 500 = @backend;
Are you sure you want to “ignore” internal server errors and instead
forward the request to the backend?

Note that as you have it right now the 500 status code will always be
returned even if the request is forwarded.

location / { location
~.*.(gif|jpg|png|ico|swf|rss|xml|htm|txt|js|css|gz|doc|xls|pdf)$ {
expires max; try_files $uri @backend; log_not_found off; }
proxy_pass http://77.12.16.8:80; include proxy.inc; }

location @backend {

internal;
^^^^^^^^^^^

Named locations are “already” internal.
Cf. http://wiki.nginx.org/HttpCoreModule#location

proxy_pass http://77.12.16.8:80;
include proxy.inc;
}

} # End of server block

RPAF STUFF FOR NGINX PROXYING

LoadModule rpaf_module modules/mod_rpaf-2.0.so
RPAFenable On
RPAFproxy_ips 127.0.0.1 77.12.16.8
RPAFsethostname On
RPAFheader X-Real-IP

I suspect that the problem is somewhere in your Apache
configuration. Try stoping both servers and starting them
again. Observe if the sockets are created and that each daemon is
listening on its respective address.

lsof -i tcp or nestat -t -l

— appa

Thanks appa, for bearing with me.

Yes, the VirtualHost config also needs the port to change. I had only
changed the “Listen” port in apache.

It works now, and splendidly!

Thanks!

Posted at Nginx Forum: