Created
September 25, 2015 01:45
-
-
Save beyoung/3fd707b6e7a2e0cf2cc0 to your computer and use it in GitHub Desktop.
nginx proxy_pass
This file contains hidden or 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
#高级配置 | |
#user nobody; | |
#自动检测 设置工作进程数 | |
worker_processes auto; | |
#worker进程的最大打开文件数限制 | |
#work_rlimit_nefile 100000; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; | |
events { | |
worker_connections 1024; | |
#告诉nginx收到一个新的通知链接之后接受尽可能多的连接。 | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
#关闭在报错时候显示的版本号。安全问题。 | |
server_tokens off; | |
#log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
# '$status $body_bytes_sent "$http_referer" ' | |
# '"$http_user_agent" "$http_x_forwarded_for"'; | |
#设置nginx是否将存储访问日志,关闭这个选项可以让读取硬盘IO操作更快。 | |
access_log off; | |
#告诉nginx只要记录严重的错误即可。 | |
#erro_log /var/log/nginx/erro.log crit; | |
#access_log logs/access.log main; | |
#可以让sendfile()发挥作用,sendfile()可以在磁盘和tcp socket之间相互拷贝数据。 | |
sendfile on; | |
#告诉nginxz在一个数据包里发送所有的文件,而不一个接一个的发送。 | |
tcp_nopush on; | |
#keepalive_timeout 0; | |
keepalive_timeout 65; | |
#是告诉nginx采用gzip的压缩形式发送数据,这将会减少发送的数据量。 | |
gzip on; | |
upstream webserver { | |
server 192.168.1.120:8088; | |
} | |
upstream images { | |
server 192.168.1.120:8080; | |
} | |
server { | |
listen 80; | |
server_name localhost; | |
#charset koi8-r; | |
#access_log logs/host.access.log main; | |
location / { | |
root html; | |
index index.html index.htm; | |
} | |
location = /hello { | |
default_type text/html; | |
content_by_lua 'ngx.say("hello world");'; | |
} | |
location = /connect { | |
default_type text/html; | |
content_by_lua_file lua/connect.luac; | |
} | |
location ~ ^/(images|javascript|js|css|flash|media|static)/ { | |
root "D:\Project Area"; | |
access_log off; | |
expires 30d; | |
} | |
#location ~ ^/ { | |
# proxy_pass http://localhost:8000; | |
#} | |
location /tulvs { | |
proxy_pass http://webserver/; | |
proxy_redirect default; | |
} | |
location /tulvi { | |
proxy_pass http://images/; | |
proxy_redirect default; | |
} | |
#error_page 404 /404.html; | |
# redirect server error pages to the static page /50x.html | |
# | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 | |
# | |
#location ~ \.php$ { | |
# proxy_pass http://127.0.0.1; | |
#} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
# | |
#location ~ \.php$ { | |
# root html; | |
# fastcgi_pass 127.0.0.1:9000; | |
# fastcgi_index index.php; | |
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; | |
# include fastcgi_params; | |
#} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
# | |
#location ~ /\.ht { | |
# deny all; | |
#} | |
} | |
# another virtual host using mix of IP-, name-, and port-based configuration | |
# | |
#server { | |
# listen 8000; | |
# listen somename:8080; | |
# server_name somename alias another.alias; | |
# location / { | |
# root html; | |
# index index.html index.htm; | |
# } | |
#} | |
# HTTPS server | |
# | |
#server { | |
# listen 443 ssl; | |
# server_name localhost; | |
# ssl_certificate cert.pem; | |
# ssl_certificate_key cert.key; | |
# ssl_session_cache shared:SSL:1m; | |
# ssl_session_timeout 5m; | |
# ssl_ciphers HIGH:!aNULL:!MD5; | |
# ssl_prefer_server_ciphers on; | |
# location / { | |
# root html; | |
# index index.html index.htm; | |
# } | |
#} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment