Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
nginxでリバースプロキシを設定する時のnginx.confなど
user nginx;
worker_processes 6;
worker_rlimit_nofile 4096;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
server_tokens off;
sendfile on;
#tcp_nopush on;
keepalive_timeout 5;
if_modified_since before;
client_max_body_size 8M;
client_body_buffer_size 256k;
gzip on;
gzip_http_version 1.0;
gzip_vary on;
gzip_comp_level 6;
gzip_types text/plain text/xml text/css application/xhtml+xml application/xml application/rss+xml application/atom_xml application/javascript application/x-javascript application/x-httpd-php;
gzip_disable "MSIE [1-6]\.";
include /etc/nginx/conf.d/default.conf;
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=cache1:4m max_size=50m inactive=120m;
proxy_temp_path /var/tmp/nginx;
proxy_buffers 8 64k;
proxy_buffer_size 64k;
proxy_cache_key "$scheme://$host$request_uri";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 10;
proxy_send_timeout 10;
proxy_read_timeout 90;
proxy_cache_use_stale timeout invalid_header http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_cache_lock_timeout 5s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment