nginx

Nginx location, alias, rewrite, root

I'm serving /foo/bar/ by way of proxypass and want to continue doing so. However, I would like to serve /foo/bar/baz.swf statically from say /var/www/mystatic/baz.swf and so forth. I was hoping that I could do something like location /foo/bar/(.*) { alias /var/www/mystatic/; } location / { proxy_pass ....; ...

spawn-fcgi dying after a number of connections

I recently setup a new ubuntu machine, with wordpress, spawn-fcgi and nginx. Every morning, I'd try to see my blog and I got a 502 error Bad Gateway error. I tried finding some kind of log of why php-cgi died but couldn't find anything. I run spawn-fcgi like so: sudo /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f...

PHP fast-cgi module crashes after SVN export

Let me start by saying that the problem I have looks totally weird to me! On a remote server, I have nginx as the web server and PHP running as a Fast-CGI module. I also host my SVN repository on the same server. Now I have a working copy of the repo on my local computer. I make changes to them, and commit to the repo on my remote serve...

How do I stop apache2 crashing when the website gets busy?

Normally what happens is that requests seem to back up, and apache begins to consume more and more memory and CPU, until eventually it runs out of RAM and then ALL apache processes die, leaving all visitors with no website. This seems to be a common problem from people I speak to but I can't seem to find a solution! Any help much appre...

How to prevent hotlinking of streaming content?

I have a directory with my media files and I need no to display them on other sites. Server doesn't support .htaccess, because it uses nginx. How can I enable hotlink protection for my files?? Thank you. ...

Text data in form-field too long.

I have a form with a text area field. I put some text information there and send it as post request. This information is about 2M of text. Everything goes fine with server and database because post request sends this amount of data to server and mysql saves it correctly in DB. Problem is that after that I just can't render text data back...

Using deprec with passenger and nginx

Has anyone come up with a recipe for installing Phusion Passenger fronted by nginx instead of Apache? Or at least some automated way of installing those two, that works alongside a cap/deprec deploy? ...

nginx/redis and handling tracking params in url

I am using nginx and redis in my website. For several items on my site, I want to add tracking params to their urls so that when a user clicks on an item, I can collect statistics of user usage apart from serving the content user requested. I am looking for methods on how to capture this statistics in redis from nginx, i.e. without hitti...

replacing double forward slashes in nginx

Hi, Does anyone know how to best remove double forward slashes from urls in nginx? E.g. redirect www.a.com//a -> www.a.com/a Thanks, Peder ...

HTTP 411 error with J2ME -> nginx + apache + django

We have a web based application in production built using django. It is deployed on nginx proxied with apache which handles the django app via WSGI. OS is Ubuntu. In addition to the web based front-end, we recently developed a J2ME client for uploading files via mobile phone. The J2ME transfers the file with Transfer-Encoding set as "Ch...

Can't force Rails into production environment via Passenger/Nginx

Hi- I'm having trouble getting a Rails app to run in the production environment via Phusion Passenger on Nginx/Ubuntu. According to the docs, the environment is controlled by the rails_env option in nginx.conf ... but it runs in development mode on our box regardless of whether we specify 'rails_env production;' or leave it out (the de...

nginx not forwarding POST to @fallback

Hello. I wrote a high-performance HTTP event server in C++ and I want to make it work flawlessly with nginx and PHP-FPM (fastcgi). This is a snippet of my nginx configuration. location ~ \.eve$ { gzip off; proxy_redirect off; proxy_buffering off; proxy_pass http://127.0.0.1:9001; proxy_interce...

How would I convert my .htaccess file to NGINX?

How would I convert my below .htaccess (Apache) file so that it could be used by NGINX? Options -Indexes Options +FollowSymLinks # Enable ETag #FileETag MTime Size FileETag none # Set expiration header ExpiresActive on ExpiresDefault A2592000 Header append Cache-Control "public" # Compress some text file types AddOutputFilterByType D...

Does/can Passenger use clusters like Mongrel?

I'm just curious if Passenger does or can utilize clusters like Mongrel can. If so, how can I specifically run Passenger with clusters? I'm using nginx. And if not, how does it outperform Mongrel so well? ...

nginx and auth_basic

I am trying to get basic authentication working with nginx in Ubuntu Jaunty. In nginx.conf, I added these two lines under the server context: server { ... auth_basic "Restricted Access"; auth_basic_user_file /etc/nginx/.htpasswd; ... } Then I apt-get'ed apache2-utils to get htpasswd, which I used to create the htpasswd fi...

Does a seperate MySQL server makes sense when using nginx instead of Apache

Consider a web app in which a call to the app consists of php script running several MySQL queries, some of them memcached. The PHP does not do very complex job. it is mainly serving the mysql data with some formatting. In the past it used to be recommended to put mysql and the app engine (PHP/Apache) on seperate boxes. However, whe...

Tracking system and real time stats analysis in Python

This question is related to an older question: http://stackoverflow.com/questions/2019096/mysql-tracking-system. In short: I have to implement a tracking system that will have high loads using Python. For the database part I've settled on mongoDB (which sounds like the right tool for this job). The development language will be Python. ...

Nginx Proxy to Files on Local Disk or S3

So I'm moving my site away from Apache and onto Nginx, and I'm having trouble with this scenario: User uploads a photo. This photo is resized, and then copied to S3. If there's suitable room on disk (or the file cannot be transferred to S3), a local version is kept. I want requests for these images (such as http://www.mysite.com/p/1_1....

nginx - client_max_body_size has no effect

Hi, nginx keeps saying "client intended to send too large body". Googling and RTFM pointed me to "client_max_body_size". I set it to 200m in the nginx.conf as well as in the vhost conf, restarted Nginx a couple of times but I'm still getting the error message. Did I overlook something? The backend is php-fpm (max_post_size and max_uplo...

Why Aren't Django Static Generator & Nginx Giving Me Boss Speed?

So there have been lots of articles like this one recently, extolling the virtues of Django Static Generator when used in combination with a light front-end Web server. It makes a whole lot of sense to me. However, I get nothing like the results that other people are reporting -- thousands of requests per second -- and I don't know why ...