| Name |
Space |
Section |
Version |
Status |
Reviewed |
Author(s) |
| NGINX for Pylons |
Pylons Cookbook |
Deployment |
1.0 |
Draft |
False |
Pradeep Gowda |
Introduction
This article describes how to configure an NGINX server to proxy to a Pylons application run using the paster serve command.
location / {
include /usr/local/nginx/conf/proxy.conf;
proxy_pass http://127.0.0.1:8080;
proxy_redirect default;
}
The complete configuration is listed below. Copy this file to /etc/nginx or /usr/local/nginx/conf/ depending on your installation path.
worker_processes 2;
events {
worker_connections 1024;
}
http {
include conf/mime.types;
default_type application/octet-stream;
access_log logs/mysite.access.log ;
error_log logs/mysite.error.log;
gzip on;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 75 20;
server {
listen 80;
server_name mysite.com;
#site runs on Pylons
location / {
include /usr/local/nginx/conf/proxy.conf;
proxy_pass http://127.0.0.1:8080;
proxy_redirect default;
}
#Blog runs on wordpress,
#so pass the control to apache running on port 81
location /blog{
proxy_pass http://127.0.0.1:81;
proxy_redirect default;
}
#URL Rewrite example
rewrite ^/feed/(.*)$ /blog/feed/$1 permanent;
}
}
The proxy file referred above is given below.
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
Shouldn't this page belong to "Deployment" section of the cookbook?