nginx

Problem downloading large files with Rails, Nginx (with x-accel-redirect) and Apache(x-sendfile)

Hi to all! We have a big problem with downloads when the size is over than 1gb. We are using Rails 2.3.5, passenger 2.2.9 on Amazon EC2 2gb with 2gb of Ram and Fedora 10. Files are stored on /mnt/files, project is on /mnt/www/project We tried to send files with Nginx and x-accel-redirect and also Apache with x-sendfile. We can down...

Django + NGINX URL Problem

I have set up Django's FastCGI + NGINX, but it's only working for root url: any request to http://example.com/anything redirects to http://example.com. Django's internal server working fine, NGINX static file serving and FastCGI processing of the root URL is fine, error log is clear. Here is my config's server section: server { ...

Dynamically create image thumbnails (using django)

I would like to dynamically create thumbnails based on parameters in the URL. For example, http://mysite.com/images/1234/120x45.jpg would create a 120x45 thumbnail for image id 1234. The obvious solution to this is to have a django view which does the following: Look for a previously cached version of the image at this size. Create a ...

Why use Apache over NGINX/Cherokee/Lighttpd?

Apache has been the de facto standard web server for over a decade, but recent years have brought us web servers that consume less RAM and handle many more requests per second using fewer threads and asynchronous i/o. In my opinion, I also find the configuration of these servers to be more straightforward and minimal. Why do people use ...

SWFUpload prematurely closing the connection on upload (nginx 499)

I'm using swfupload to upload files to nginx. It works fine for me & 99% of our users. For a couple of users, however, it fails somehow during upload. It opens a connection, but seems to close it before it's complete - nginx reports a 499 status in its access log, which is NGX_HTTP_CLIENT_CLOSED_REQUEST. I managed to get hold of one o...

CakePHP in a subdirectory using nginx (Rewrite rules?)

I managed to get this to work a while back, but on returning to the cakephp project I had started it seems that whatever changes I've made to nginx recently (or perhaps a recent update) have broken my rewrite rules. Currently I have: worker_processes 1; events { worker_connections 1024; } http { include mime.types; ...

Nginx proxy_pass to a password protected upstream.

I want to pass a request to an upstream server. The original url is not password protected but the upstream server is. I need to inject a Basic auth username/password into the request but get errors when doing: upstream supportbackend { server username:[email protected]; } and upstream supportbackend { ser...

Using nginx for polling rss

I'm interested in using Nginx for polling rss feeds. Here's the problem: I have about 1,000 very large feeds -- where I'm going to use superfeedr.com I have about 20,000 very small blogs where I need to have my own infrastructure built to poll RSS feeds. (superfeedr is just too expensive, and I'm looking at an infrastructure i can exte...

What should my Nginx rewrite rules be for Rails with Passenger for page caching in a subdirectory?

I'm using Nginx 0.7.64, Passenger 2.2.9, Rails 2.3.5. I have my page caching directory set to /public/cache, and I'd like to be able to serve cached pages when requested over HTTP, but always hit the Rails app when requested over HTTPS. The bulk of my config looks like this: server { listen 80; server_name website.com www.website....

I designed an architecture for web app running on single computer

Hi, I am planning to build a web app running on a single computer and exploit the hardware resources as efficient as possible. The logic of app will not be complex. The following is my design: OS: Linux (CentOS 5) Web Server: Nginx Web script: PHP Database: Tokyo cabinet + Tokyo Tyrant Index: Sphinx I am not going to use RDBMS such...

C language FastCGI with Nginx

I am attempting to run a fastcgi app written in C language behind the Nginx web server. The web browser never finishes loading and the response never completes. I am not sure how to approach it and debug. Any insight would be appreciated. The hello world application was taken from fastcgi.com and simplified to look like this: #include...

nginx as a reverse proxy to limit http verb access

So I've got an app that uses CouchDB as the backend. Couch doesn't really have it's security/user model in place yet, and by default anyone can do anything (including deleting records and even the entire database). But, if we limit access to only GET requests we're much safer. I was hoping I could put nginx out front as a reverse proxy,...

Trouble setting expiration for static asset in nginx

I have the following location directive in my nginx config file: server{ ... location ~* .js$ {expires 1d;} ... location / { ... } } I expect a file served by this URL http://www.mydomain.com/javascripts/myfile.js to have an expiration of +1 day, but I am seeing an expiration of +20 years. What am I doing wrong? ...

Setting up nginx to redirect mobile users

I want my website to redirect mobile users from mydomain.com to m.mydomain.com (unless they have specifically asked to see the non-mobile site). I was doing this in my application using WURFL, but I want to enable page caching. If page caching is on, the application will never be reached to know to redirect the mobile user, and so I nee...

Django admin authentication failure

Hi folks, logging into django admin fails when 'log in' button is pressed first time, but pressing "back" and "log in' again - logs the user in successfully. I am deploying Django app with zc.buildout here, with a setup similar to what is described here http://www.meppum.com/2009/jan/17/installing-django-ubuntu-intrepid/. Nginx (listen...

Dynamically Create Virtual Hosts with Rails, Nginx?

I really like Basecamp's idiom of "dynamically" creating custom virtual hosts for clients -- for instance, once a company has signed up they may quickly login to a special URL like: https://mystartup.basecamphq.com/ --which I think is really neat, it segregates multiple organizations nicely within a single application. My question is:...

Where should I set HTTP headers, such as Expires?

I want to deploy an app using Sinatra on Phusion Passenger w/ nginx. If I want to set the Expires header on my static content - stylesheets, say - there are appear to be three places where I could accomplish this. In my Sinatra app, using the API With Rack middleware In the server config for my deployment Which of these methods is t...

Passenger+nginx: Hosting a Rails application in a subdirectory

I'm trying to deploy an application in a subdirectory /a under www.myserver.com, following the steps in the Passenger docs here: http://www.modrails.com/documentation/Users%20guide.html#deploying_rails_to_sub_uri This seems to work, but the Rails routes are now all expecting the additional subdirectory /a, such that trying to access the...

nginx location regex

I'm setting up nginx and I need to use the location directive to match all requests that begin with /site1 AND end with .php. What regex do I use to do this? I know I can use ^ to match the beginning of the string and $ to match the end of string. So I'm able to match the beginning of the string OR the end of the string as ^(/site)|(\.p...

Passenger hosted Rails app *painfully* slow, but the server is a beast...

I have been working to deploy a relatively large Rails app (Rails 2.3.5) and recently doing some load testing we discovered that the throughput for the site is way below the expected level of traffic. We were running on a standard 32bit server, 3GB of RAM with Centos, and we were running Ruby Enterprise Edition (latest build), Passenger...