nginx反代理服务器
2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
nginx反代理配置:
server {
??? listen?????? 8082;
??? server_name? localhost,10.20.1.160;
#??? charset???? utf-8;
#??? index??????? index.php index.html index.htm;
??? root???????? /app/usercenter/web;
??? #charset koi8-r;
??? #access_log? /var/log/nginx/log/host.access.log? main;
??? location /132/8080/ {
??????? proxy_pass?? http://10.20.1.132:8080/;
??????? client_max_body_size?????? 10m; #允許客戶端請(qǐng)求的最大單文件字節(jié)數(shù)
??????? client_body_buffer_size??? 128k; #緩沖區(qū)代理緩沖用戶端請(qǐng)求的最大字節(jié)數(shù)
??????? proxy_connect_timeout????? 300; #nginx跟后端服務(wù)器連接超時(shí)時(shí)間(代理連接超時(shí))
??????? proxy_send_timeout???????? 300; #后端服務(wù)器數(shù)據(jù)回傳時(shí)間(代理發(fā)送超時(shí))
??????? proxy_read_timeout???????? 300; #連接成功后,后端服務(wù)器響應(yīng)時(shí)間(代理接收超時(shí))
??????? proxy_buffer_size????????? 4k; #設(shè)置代理服務(wù)器(nginx)保存用戶頭信息的緩沖區(qū)大小
??????? proxy_buffers????????????? 4 32k; #proxy_buffers緩沖區(qū),網(wǎng)頁平均在32k以下的話,這樣設(shè)置
??????? proxy_busy_buffers_size??? 64k; #高負(fù)荷下緩沖大小(proxy_buffers*2)
??????? proxy_temp_file_write_size 64k; #設(shè)定緩存文件夾大小,大于這個(gè)值,將從upstream服務(wù)器傳
??? }
??? location /132/8081/ {
??????? proxy_pass?? http://10.20.1.132:8081/;
??????? client_max_body_size?????? 10m; #允許客戶端請(qǐng)求的最大單文件字節(jié)數(shù)
??????? client_body_buffer_size??? 128k; #緩沖區(qū)代理緩沖用戶端請(qǐng)求的最大字節(jié)數(shù)
??????? proxy_connect_timeout????? 300; #nginx跟后端服務(wù)器連接超時(shí)時(shí)間(代理連接超時(shí))
??????? proxy_send_timeout???????? 300; #后端服務(wù)器數(shù)據(jù)回傳時(shí)間(代理發(fā)送超時(shí))
??????? proxy_read_timeout???????? 300; #連接成功后,后端服務(wù)器響應(yīng)時(shí)間(代理接收超時(shí))
??????? proxy_buffer_size????????? 4k; #設(shè)置代理服務(wù)器(nginx)保存用戶頭信息的緩沖區(qū)大小
??????? proxy_buffers????????????? 4 32k; #proxy_buffers緩沖區(qū),網(wǎng)頁平均在32k以下的話,這樣設(shè)置
??????? proxy_busy_buffers_size??? 64k; #高負(fù)荷下緩沖大小(proxy_buffers*2)
??????? proxy_temp_file_write_size 64k; #設(shè)定緩存文件夾大小,大于這個(gè)值,將從upstream服務(wù)器傳
??? }
??? error_page?? 500 502 503 504? /50x.html;
??? location = /50x.html {
??????? root?? /usr/share/nginx/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
??? #
??? # deny access to .htaccess files, if Apache's document root
??? # concurs with nginx's one
??? #
??? #location ~ /\.ht {
??? #??? deny? all;
??? #}
}
?
???
轉(zhuǎn)載于:https://my.oschina.net/u/2285247/blog/1539817
總結(jié)
以上是生活随笔為你收集整理的nginx反代理服务器的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: wamp 安装monggo扩展
- 下一篇: SylixOS 无Uboot版BSP