Created
September 22, 2010 14:11
-
-
Save mping/591737 to your computer and use it in GitHub Desktop.
nginx config for reverse proxy based on url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Simple basic nginx conf sample for setting up a reverse proxy | |
# | |
#user nobody; | |
worker_processes 1; | |
error_log logs/error.log info; | |
#pid logs/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
access_log logs/access.log; | |
sendfile on; | |
#tcp_nopush on; | |
#keepalive_timeout 0; | |
keepalive_timeout 65; | |
proxy_cache_path D:/mping/devel/temp/cache levels=1:2 keys_zone=my-cache:8m max_size=1000m inactive=600m; | |
proxy_temp_path D:/mping/devel/temp; | |
port_in_redirect off; | |
gzip on; | |
gzip_vary on; | |
gzip_comp_level 5; | |
gzip_http_version 1.0; | |
gzip_min_length 0; | |
gzip_types text/plain text/html text/css image/x-icon application/x-javascript; | |
server { | |
listen 80; | |
server_name mping; | |
proxy_cache my-cache; | |
proxy_set_header Host $host; | |
port_in_redirect off; | |
client_max_body_size 40m; | |
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; | |
#main location | |
location / { | |
proxy_pass http://localhost:9080; | |
proxy_redirect http://localhost:9080/ http://$host:$server_port/; | |
port_in_redirect off; | |
add_header Reverse-Proxy false; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
} | |
#reverse proxy for cache | |
# location ~* \.(gif|jpg|jpeg)$ { | |
location ^~ /agile/javax.faces.resource/ { | |
proxy_pass http://localhost:9080; | |
proxy_redirect http://localhost:9080/ http://$host:$server_port/; | |
port_in_redirect off; | |
#this is where cached stuff will be saved | |
root D:/mping/devel/temp/cache; | |
add_header Reverse-Proxy true; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment