#user nobody;
worker_processes 1;
#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;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
upstream aaa {
#ip_hash;
server 192.168.8.101:1000 weight=6;
server 192.168.8.101:2000 weight=4;
server 192.168.8.101:3000 down;
server 192.168.8.101:3000 backup;
}
server {
listen 8000;
server_name 192.168.8.101;
gzip on;
gzip_buffers 32 4K;
gzip_comp_level 6;
gzip_min_length 100;
gzip_types application/javascript text/css text/xml;
gzip_disable "MSIE [1-6]\."; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)
gzip_vary on;
root D:\workProject\front\supplier-web\platform-web\dist;
index index.html index.htm;
location /supplier {
alias D:\workProject\front\supplier-web\supplier-web\dist;
index index.html index.htm;
}
location /center {
alias D:\workProject\front\supplier-web\centralized-web\dist;
index index.html index.htm;
}
location ^~ /api/ {
proxy_pass http://192.168.8.101:9000/;
proxy_set_header Host $http_host;
}
location / {
client_max_body_size 100m;
try_files $uri $uri/ index.html @index;
}
location @index {
add_header Cache-Control no-cache;
expires 0;
try_files /index.html =404 index.html;
}
error_page 500 502 503 504 =200 /50x.html;
location = /50x.html {
root html;
}
}
# server {
# listen 1000;
# server_name 192.168.8.101;
# location / {
# root D:\workProject\front\supplier-web\platform-web\dist;
# index index.html index.htm;
# }
# }
# server {
# listen 2000;
# server_name 192.168.8.101;
# location / {
# root D:\workProject\front\supplier-web\supplier-web\dist;
# index index.html index.htm;
# }
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root html;
# }
# }
# server {
# listen 3000;
# server_name 192.168.8.101;
# location / {
# root D:\workProject\front\supplier-web\centralized-web\dist;
# index index.html index.htm;
# }
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root html;
# }
# }
server {
listen 4000;
server_name 192.168.8.101;
location / {
root D:\workProject\front\supplier-web\supplier-wx-h5\dist\build\h5;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 8080;
server_name 192.168.8.101;
gzip on;
gzip_buffers 32 4K;
gzip_comp_level 6;
gzip_min_length 100;
gzip_types application/javascript text/css text/xml;
gzip_disable "MSIE [1-6]\."; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)
gzip_vary on;
root D:\workProject\front\medical-consumables-website\dist\mc;
index index.html index.htm;
location ^~ /admin-center {
alias D:\workProject\front\medical-consumables-website\dist\system;
index index.html index.htm;
try_files $uri $uri/ index.html @index;
#proxy_pass http://192.168.8.101:8083/;
#proxy_set_header Host $http_host;
}
location ^~ /api/ {
client_max_body_size 100m;
proxy_pass http://192.168.8.101:8081/;
proxy_set_header Host $http_host;
}
location / {
client_max_body_size 100m;
try_files $uri $uri/ index.html @index;
}
location @index {
add_header Cache-Control no-cache;
expires 0;
try_files /index.html =404 index.html;
}
location ^~ /minio/ {
proxy_pass http://192.168.8.106:9000/;
proxy_set_header Host $http_host;
}
location ^~ /demo/ {
proxy_pass http://192.168.8.101:6868;
proxy_set_header Host $http_host;
}
}
server {
listen 8083;
server_name 192.168.8.101;
gzip on;
gzip_buffers 32 4K;
gzip_comp_level 6;
gzip_min_length 100;
gzip_types application/javascript text/css text/xml;
gzip_disable "MSIE [1-6]\."; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)
gzip_vary on;
root D:\workProject\front\medical-consumables-website\dist\system;
index index.html index.htm;
location ^~ /api/ {
proxy_pass http://192.168.8.101:8081/;
proxy_set_header Host $http_host;
proxy_read_timeout 300;
}
location / {
client_max_body_size 100m;
try_files $uri $uri/ index.html @index;
}
location @index {
add_header Cache-Control no-cache;
expires 0;
try_files /index.html =404;
}
}
server {
listen 9010;
server_name 192.168.8.101;
gzip on;
gzip_buffers 32 4K;
gzip_comp_level 6;
gzip_min_length 100;
gzip_types application/javascript text/css text/xml;
gzip_disable "MSIE [1-6]\."; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)
gzip_vary on;
root D:\workProject\front\material-wechat-group-h5\dist\build\h5;
index index.html index.htm;
location ^~ /api/ {
client_max_body_size 100m;
proxy_pass http://192.168.8.101:7000/;
proxy_set_header Host $http_host;
}
location ^~ /WW_verify_sfhyyHZlQfkdAqDb.txt {
client_max_body_size 100m;
proxy_pass http://192.168.8.101:7000/mmcwx/WW_verify_sfhyyHZlQfkdAqDb.txt/;
proxy_set_header Host $http_host;
}
location / {
client_max_body_size 100m;
try_files $uri $uri/ index.html @index;
}
location @index {
add_header Cache-Control no-cache;
expires 0;
try_files /index.html =404 index.html;
}
}
server {
listen 9090;
server_name 192.168.8.101;
add_header 'Access-Control-Allow-Methods' 'GET,OPTIONS,POST' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Origin' $http_origin always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-Requested-With, Cache-Control' always;
if ($request_method = OPTIONS ) { return 200; }
location / {
add_header 'Access-Control-Allow-Methods' 'GET,OPTIONS,POST' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Origin' $http_origin always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-Requested-With, Cache-Control' always;
if ($request_method = OPTIONS ) { return 200; }
client_max_body_size 100m;
proxy_pass http://192.168.8.101:8081/;
proxy_set_header Host $http_host;
proxy_read_timeout 300;
}
}
server {
listen 5000;
server_name 192.168.8.101;
location / {
proxy_redirect off ;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_buffer_size 1600k;
proxy_buffers 4 3200k;
proxy_busy_buffers_size 6400k;
proxy_temp_file_write_size 6400k;
proxy_max_temp_file_size 128m;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_pass http://aaa;
}
}
#正向代理
server {
resolver 114.114.114.114; #指定DNS服务器IP地址
listen 90;
location / {
proxy_pass http://$host$request_uri; #设定代理服务器的协议和地址
proxy_set_header HOST $host;
proxy_buffers 256 4k;
proxy_max_temp_file_size 0k;
proxy_connect_timeout 30;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_next_upstream error timeout invalid_header http_502;
}
}
server {
resolver 114.114.114.114; #指定DNS服务器IP地址
listen 4433;
location / {
proxy_pass https://$host$request_uri; #设定代理服务器的协议和地址
proxy_buffers 256 4k;
proxy_max_temp_file_size 0k;
proxy_connect_timeout 30;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_next_upstream error timeout invalid_header http_502;
}
}
# 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;
# }
#}
}
Nginx配置
于 2023-01-18 15:55:55 首次发布