Skip to content

Instantly share code, notes, and snippets.

@j100002ben
Created October 15, 2013 09:29
Show Gist options
  • Save j100002ben/6989038 to your computer and use it in GitHub Desktop.
Save j100002ben/6989038 to your computer and use it in GitHub Desktop.
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
proxy_cache_path /data/nginx/cache levels=2:2:2 max_size=51200m inactive=5d keys_zone=default:512m;
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
# root /usr/share/nginx/www;
# index index.html index.htm;
# Make site accessible from http://localhost/
# server_name localhost;
client_header_buffer_size 8k;
etag off;
location /post/recept/ {
proxy_pass http://127.0.0.1:1234;
include /etc/nginx/proxy_params_api;
}
location /jfont/api/ {
proxy_pass http://127.0.0.1:1234;
include /etc/nginx/proxy_params_api;
}
location /old/ {
proxy_pass http://127.0.0.1:1234;
include /etc/nginx/proxy_params;
if_modified_since before;
}
location /file/ {
proxy_pass http://127.0.0.1:1234;
include /etc/nginx/proxy_params;
if_modified_since before;
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
location = /404.html {
root /usr/share/nginx/www;
}
}
user www-data;
worker_processes 4;
worker_cpu_affinity 00000001 00000010 00000100 00001000;
worker_rlimit_nofile 102400;
pid /var/run/nginx.pid;
events {
worker_connections 102400;
# multi_accept on;
# use epoll;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay off;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log off;
# access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
# gzip on;
# gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering on;
proxy_buffer_size 8k;
proxy_buffers 12 32k;
proxy_cache default;
proxy_cache_key "$request_uri$request_body";
proxy_cache_methods GET HEAD POST;
proxy_cache_lock on;
proxy_cache_lock_timeout 10s;
proxy_cache_use_stale timeout;
proxy_cache_valid 200 5d;
proxy_cache_valid 404 1m;
proxy_cache_valid any 1m;
proxy_connect_timeout 3s;
proxy_http_version 1.1;
proxy_ignore_client_abort on;
proxy_read_timeout 10s;
proxy_intercept_errors on;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment