nginx配置反向代理商
这章讲的是nginx配置文件的知识,配置反向代理商。
1、nginx配置反向代理商,代理商到tomcat页面
#cat /usr/local/work/nginx/nginx.conf
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
worker_rlimit_nofile 102400;
events {
use epoll;
multi_accept on;
worker_connections 102400;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60;
server_tokens off;
client_header_buffer_size 2k;
large_client_header_buffers 4 4k;
client_max_body_size 60m;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
upstream tomcats {
server 192.168.1.4:8080;
server 192.168.1.5:8080;
}
server {
listen 443 ssl;
server_name open.baidu.com;
ssl_certificate /usr/local/work/nginx/ssl/nginx.crt;
ssl_certificate_key /usr/local/work/nginx/ssl/nginx.key;
ssl_client_certificate/usr/local/work/nginx/ssl/cacert.pem;
ssl_verify_clienton;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://tomcats;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_set_header Accept-Encoding “”;
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_set_header X-Forwarded-Proto $scheme;
add_header Front-End-Https on;
proxy_redirect off;
}
}
}
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是摆设,本站源码仅提供给会员学习使用!
7. 如遇到加密压缩包,请使用360解压,如遇到无法解压的请联系管理员
开心源码网 » nginx配置反向代理商