nginx内网常规配置
## THE IP ADDRESS OF "bpsrms.demo.com.local" ##
upstream bpsrms.demo.com.local {
server 10.99.11.141:6060;
}
## THE SERVER INFOMATION OF "bpsrms.demo.com.local" ##
server
{
listen 80;
server_name bpsrms.demo.com.local;
access_log /usr/local/nginx/logs/bpsrms.demo.com.local.access.log main;
location / {
proxy_pass http://bpsrms.demo.com.local;
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;
client_max_body_size 100m;
proxy_connect_timeout 75s;
proxy_read_timeout 300s;
}
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 501;
}
proxy_intercept_errors on;
error_page 500 502 503 504 /50x.html;
error_page 404 /404.html;
location ~ /(404|50x).html {
root html/errorHtml;
}
location ~ .*/errorHtml/ {
rewrite ^/.*/(errorHtml/.*)$ /$1 permanent;
access_log off;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
log_not_found off;
}
}
nginx内网目录跳转配置
## THE IP ADDRESS OF "dataxweb.demo.com" ##
upstream dataxweb.demo.com {
server 10.99.11.140:8080;
server 10.99.11.141:8080 backup;
}
## THE SERVER INFOMATION OF "dataxweb.demo.com" ##
## HTTP REWRITE TO HTTPS
server {
listen 80;
server_name dataxweb.demo.com;
rewrite ^(.*)$ https://$host/cbs/$1 permanent;
}
## SERVER INFO
server {
listen 443;
server_name dataxweb.demo.com;
ssl on;
ssl_certificate aNoahwm(sha2).pem;
ssl_certificate_key aNoahwm(sha2).key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES';
ssl_prefer_server_ciphers on;
access_log /usr/local/nginx/logs/dataxweb.demo.com.access.log main;
location / {
rewrite ^(.*)$ https://$host/cbs/$1 permanent;
}
location ^~ /cbs/ {
proxy_set_header SSL_CERT $ssl_client_cert;
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;
proxy_pass http://dataxweb.demo.com/cbs/;
client_max_body_size 100m;
proxy_connect_timeout 75s;
proxy_read_timeout 300s;
}
location ^~ /ueditor/ {
proxy_set_header SSL_CERT $ssl_client_cert;
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;
proxy_pass http://dataxweb.demo.com/ueditor/;
client_max_body_size 100m;
proxy_connect_timeout 75s;
proxy_read_timeout 300s;
}
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 501;
}
proxy_intercept_errors on;
error_page 500 502 503 504 /50x.html;
error_page 404 /404.html;
location ~ /(404|50x).html {
root html/errorHtml;
}
location ~ .*/errorHtml/ {
rewrite ^/.*/(errorHtml/.*)$ /$1 permanent;
access_log off;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
log_not_found off;
access_log off;
}
}