nginx

Django & Nginx deeplinking domains (re-write rules or django urls?)

I'm running Django behind Nginx (as FASTCGI) and I need to "deeplink" to a page in one domain from the root of another without redirecting or forwarding e.g. Given that I have a domain general-stuff.com and a matching URL http://general-stuff.com/books/ and that I have a second domain books-stuff.com I need a way to get the page served ...

nginx: parse *.cgi as php

Is it possible to parse *.cgi files as php, and how? location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_param SCRIPT_FILENAME /srv/htdocs$fastcgi_script_name; include /etc/nginx/fastcgi_params; } ...

"Connection Reset" error on Django Admin file upload

WheneverI try to upload an mp3 file through a CMS I built with the Django Admin contrib pacakage, the server takes a couple minutes, then gives me a "Connection was reset" error. I'm running Django on a CentOS server using NGINX which is proxying Apache with mod_wsgi for python. Could this be a server settings issue? ...

Set php include_path from nginx

Apache lets you set php.ini values for virtual hosts with the php_value directive. Does nginx have something similar? Is there another way to set the include_path on a per-site basis? ...

Jquery-upload-progress cross domain issue. Suspected GET request problem.

Hi, I am doing a site which submits a form to a different server. For upload progress tracking I use: for server side the NginxHttpUploadProgressModule und for client side - jquery-upload-progress. I have tested the setup by submitting the form to the same server and everything worked fine. Submitting to another server doesn't show the p...

how can I create a file with file_put_contents that has group write permissions?

I am using file_put_contents to create a file. My php process is running in a group with permissions to write to the directory. When file_put_contents is called, however, the resulting file does not have group write permissions (it creates just fine the first time). This means that if I try to overwrite the file it fails because of a lac...

How to setup nginx + php-fpm + wordpress for only certain URLs?

I'm trying to get nginx + php-fpm +wordpress to serve some pages from my site while acting as a proxy to other pages. ie: host/foo -> proxy to another www server host/bar -> wordpress (via fpm) the proxy part works fine, but the nginx -> wordpress part just keeps redirecting to the root page. When i strace the php-fpm process, i ...

Proxy pass to multiple upstreams

Is there a directive in apache or nginx (preferably) that allows to replicate an incoming stream to multiple upstreams simultaneously? The reason I need this: I want to stream live video content from one client to a number of Flash RMTP servers that will make that content available to a number of clients. This setup is working on one s...

In nginx, what is the relationship between worker_connections, keepalive_timeout and $connection

The nginx documentation says max_clients = worker_processes * worker_connections but how does the keepalive factor into this? I have my configuration setup with 2 worker_processes and 8192 worker_connections; that means I can theoretically handle a maximum of 16384 concurrent connections. Pushing out 16384 streams of data concurrently...

How to uninstall Passenger (mod_rails) from nginx?

I've a running nginx and Ubuntu 8.09 site running a rails app -- but we are not making use of Peassenger anymore and it seems to take up a lot of memory. I google around and there's tons of info on how to install Passenger, but I didn't find any on uninstalling. ...

Problems with flash uploader progress indicator and nginx

So I am trying to use a flash uploader (specifically uploadify, but tried swfuploader as well) and for some reason the progress isn't being tracked correctly. I am about to give apache a try, but would prefer to use nginx due to its lower memory consumption and speed. Now this isn't an issue with an upload_progress module, since flash it...

Rails app crashes and burns when sending a GET request with Content-Type header set

I have created a rails application that has a simple RESTful json API. This has worked for a while, but now we have run into a problem. The javascript framework that makes requests adds a "Content-Type" header to all requests . . . including GET requests. It sets the header to "application/json" and causes the rails app to crash and burn...

nginx rewrite rule

HI, Given the following apache/mod_rewrite rule taken from .htaccess within minify directory on the server: RewriteRule ^([a-z]=.*) index.php?$1 [L,NE] what will be the nginx compatible equivalent of it? I have tried: rewrite ^/minify/([a-z]=.*) minify/index.php?$1 break; but that doesn't seem to work. Any ideas guys? ...

Simple rewrite rule for a nginx + apache2 with mod_wsgi

Hi guys, I'm stuck with this, my skills in the web servers area are poor... I have an Nginx acting as a proxy for an Apache2 running with mod_wsgi and mod_rewrite. What I want to do is rewrite every URL from www.example.com to example.com, i.e. stripping the www part from each URL request before serving. This is the layout of the differ...

How do I configure nginx to "fall-through" various directories to find a file?

I'm setting up nginx as an asset server for our website, but I have a requirement that nginx needs to check in two directories for the file: \assets\dir1\pic.jpg \assets\dir2\pic.jpg I need nginx to check in the \assets\dir1 first and if it can't find the file, check in \assets\dir2. The problem is that nginx only allows for t...

nginx rewrite - one more time

Assuming I've got a rule which looks like this: RewriteCond %{HTTP_HOST} app_name RewriteCond %{REQUEST_URI} !^/application/app_name/index.php RewriteRule .* /application/app_name/index.php/$0 [L] I've tried to convert it to nginx equivalent but i've failed :-) Here is my implementation (broken) if (-f $request_filename) { break; ...

NginX Log Rotation

I am serving a couple different domains through NginX on the same server and they each log to their own file. I need to set up a script to rotate, and compress these files and add it to cron. I know I have to do something to get NginX to open a new log file once I move the old one. Can someone give me the procedure for safely rotati...

Nginx Removing Upstream Servers From Pool

Our setup is standard nginx (ver 0.7.59) + thin upstream servers on Debian lenny. Right now we're on 1 beefy box for web / app and 1 db box. Recently we started noticing thins will eventually start "hanging", i.e. they will no longer receive requests from nginx. We have 15 thins running, and after 10-15 minutes, the first 1 or 2 will...

How can I be sure each process in my mongrel_cluster is handling requests?

I have a rails application that takes a while to process certain requests (as it processes image uploads). I currently have three mongrel processes in a cluster, and I expect one of the other two to handle a second request if the first one is busy. However, this doesn't seem to be happening. If I watch the output from top on the ser...

Nginx clean urls rewrite for Mediawiki

I've done my best to research and try solutions I've found before posting this, hopefully it will help others also. I'm trying to write urls in Mediawiki to domain.com/PageTitle (I know this is bad practice). I've gotten it 99% working with this: http://snipt.org/msh (off a tutorial for drupal so might be completely wrong for my purpo...