nginx

REMOTE_ADDR not getting sent to Django using nginx & tornado

Hey guys, So I got a simple setup with nginx for static media and load balancing and tornado as webserver for django (4 servers running). My problem is remote_addr not getting passed on to django so I'm getting a KeyError: article.ip = request.META['REMOTE_ADDR'] The remote address is getting sent through as X-Real-IP (HTTP_X_REAL_IP)...

Nginx rewrite non-www-prefixed domain to www-prefixed domain

I see the Nginx HttpRewriteModule documentation has an example to rewrite a www-prefixed domain to a non-www-prefixed domain: if ($host ~* www\.(.*)) { set $host_without_www $1; rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains '/foo', not 'www.mydomain.com/foo' } How can I do the reverse-- rewrite a non-www-prefi...

Any Full "Ruby Stack" AMI on EC2 ?

What is best available EC2 AMI that have satisfy following must have? Ruby Stack Pre Installed MySql Installed and configured with Ruby Monit Installed Nginx Secure SSH access Please let me know AMI you are recommending you have used or not? Amazon lacks proper review system for AMI unlike product/book previews. ...

PHP not able to set cookies through Nginx

I've got a PHP-fpm setup on nginx setup according to this article: http://interfacelab.com/nginx-php-fpm-apc-awesome/ PHP is not able to set cookies in any browser visiting the server. It seems nginx is not passing on the Cookie header to the browser. I Googled around a bit, and found that I need to set fastcgi_pass_header Set-Cookie in...

Nginx rewrite rule: check for nonexistant files and folders

I'm trying to set-up nginx rewrite rules as the following: Original structure: domain.com/index.php?site=project Now I tried to mask it using the nginx rewrite engine: if (-f $request_filename) { break; } if (!-f $request_filename) { rewrite ^/(.+)$ /index.php?site=$1 last; break; } How do ...

how to process long-running requests in python workers?

Hi, I have a python (well, it's php now but we're rewriting) function that takes some parameters (A and B) and compute some results (finds best path from A to B in a graph, graph is read-only), in typical scenario one call takes 0.1s to 0.9s to complete. This function is accessed by users as a simple REST web-service (GET bestpath.php?f...

Problem compiling nginx on Solaris 10

My setup as below # export PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin # ./configure --prefix=/usr/local/nginx --user=webservd --group=webservd --with-http_stub_status_module --with-openssl=/usr/local/ssl/bin/openssl --with-debug --with-pcre=/usr/local/bin and i get error code as such when i execute make # make m...

Passenger, Nginx, and Capistrano - Passenger not launching Rails app at all

Essentially, my route is working perfectly, Passenger seems to be loading - all is hunky-dory. Except that nothing Railsy happens. Here's my Nginx log from starting the server to the first request (ignore the different domain/route - it's because I haven't moved the new domain over yet, and it's returning a 403 error because there's no i...

django fastcgi nginx

i m using django with fastcgi + nginx.I want to know were the logs (error) are stored in this case ...

SSL slowness in EC2

We've deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web servers. Each web server also runs nginx with a cluster of mongrels. The nginx here takes care of static content and load balancing the mo...

nginx errors readv() and recv() failed

I use nginx along with fastcgi. I see a lot of the following errors in the error logs readv() failed (104: Connection reset by peer) while reading upstream and recv() failed (104: Connection reset by peer) while reading response header from upstream I don't see any problem using the application. Are these errors serious or ...

Nginx raises 404 when using format => 'js'

Hi, I upload images to my App using Ajax and an Iframe. In Development everything works like a charm. But in production Nginx suddenly raises a 404 error. When I look into the log, the request never hits the Rails app. So I guess it has something to do with my Nginx configuration (maybe gzip compression). The failing requests is send t...

Configure nginx for jboss/tomcat

Used to be in order to pass traffic to jboss/tomcat on port 80 using apache, we had to install and configure mod_jk. Is there an equivalent for nginx? Basically want all port 80 traffic to be passed to jboss. ...

Nginx 301 redirect inc. set cookie

Hi, what I'm looking for is the ability for nginx to detect that a url has the query string variable cid. for example www.adomain.com/froggy?cid=12&as=false (query string can be solo or mixed with others and cid is not necessarily the first variable in the query string) If cid is detected, it must send out a set cookie header with the ...

How do I show what fields a struct has in gdb?

I came upon a struct called ngx_http_variable_value_t in my gdb session and I would like to print what fields it has in the console. Is that possible? ...

what user I should run my nginx or php-fpm processes

Ok. Im little bit confused about those permissions in linux so please people help me out. The trouble is that I dont want to run server as root, so I created another user with sudo privileges so he runs the nginx and php-fpm servers (example "sudo_user"). But the trouble is for example I have "some_user" and he has a directory of his web...

Server sent unexpected return value (405 Not Allowed). Nginx, SVN

All greetings. Installed and configured the SVN, but the project is to commit a mistake and not complete. Server nginx, client - tortoise. Gives the following error: Commit failed (details follow): Server sent unexpected return value (405 Not Allowed) in response to PUT request for '/repos/!svn/wrk/79c6d77f-f269-1044-bc71-05a...

Phusion vs Mongrel for Rails application VPS

I'm working on a Rails application and it is currently hosted on a shared hosting. However, it is getting a lot of features that requires reasonable processing and I'm thinking of move it to a VPS, clouded server. I have no experience on server management, but, since it is a simple application, I'd like to manage it myself. Googling a bi...

Security sandbox violation on Nginx

Dear all, How can Nginx serve crossdomain.xml file to a flash/flex program. Basically I need to make nginx to respond to: perl -e 'printf "<policy-file-request/>%c",0' | nc 127.0.0.1 80 with <cross-domain-policy> <allow-access-from domain="*" secure="false" to-ports="*"/> <site-control permitted-cross-domain-policies="mast...

What's limiting my PHP resources?

I'm having a problem getting more memory out of PHP. This is the error message: Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 82 bytes) in ... Yet: I've set memory_limit in the php.ini file to 32M: memory_limit = 32M; I've also tried to override it manually in the actual script: ini_set('memory_...