nginx 多个80端口转发

    xiaoxiao2021-03-25  145

    #user nobody; worker_processes 2; worker_rlimit_nofile 50000; worker_cpu_affinity 00000001 10000000; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; #服务器最大支持257134 ulimit -u events { worker_connections 50000; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 64; #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; gzip_min_length 1k; #16倍申请内存 gzip_buffers 16 64k; #gzip压缩版本 gzip_http_version 1.1; gzip_comp_level 2;#gzip压缩比,1压缩比最小处理速度最快 1~9 gzip_types text/plain application/x-javascript text/css text/javascript application/javascript; gzip_vary on; #不支持1~6 IE gzip_disable “MSIE [1-6]\.”; #负载均衡 upstream bakend { ip_hash; server 127.0.0.1:9080; server 127.0.0.1:9180; } #www server { listen 8090; server_name 127.0.0.1; location / { root html; index index.html index.htm; } error_page 404 500 502 503 504 /50x.html; location = /50x.html { root html; } } #物流www server { listen 80; server_name www.****.com ; location / { proxy_pass http://127.0.0.1:8090; proxy_set_header Host $host; proxy_set_header Remote_Addr $remote_addr; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } error_page 404 500 502 503 504 /50x.html; location = /50x.html { root html; } } #物流APP server { listen 80; server_name lgs.****.com ; location / { proxy_pass http://127.0.0.1:9880; proxy_set_header Host $host; proxy_set_header Remote_Addr $remote_addr; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } error_page 404 500 502 503 504 /50x.html; location = /50x.html { root html; } } #电商APP server { listen 80; server_name emall.****.com; location / { #proxy_pass http://127.0.0.1:9080; proxy_pass http://bakend/; proxy_set_header Host $host; proxy_set_header Remote_Addr $remote_addr; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } error_page 404 500 502 503 504 /50x.html; location = /50x.html { root html; } } #物流后台 server { listen 80; server_name managelgs.****.com; location / { proxy_pass http://127.0.0.1:9780; proxy_set_header Host $host; proxy_set_header Remote_Addr $remote_addr; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } error_page 404 500 502 503 504 /50x.html; location = /50x.html { root html; } } #电商后台 server { listen 80; server_name manage.****.com; location / { proxy_pass http://127.0.0.1:9280; proxy_set_header Host $host; proxy_set_header Remote_Addr $remote_addr; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } error_page 404 500 502 503 504 /50x.html; location = /50x.html { root html; } } #电商以及物流图片 server { listen 80; server_name images.****.com; location / { proxy_pass http://127.0.0.1:1314; proxy_max_temp_file_size 0; expires 1h; } error_page 404 500 502 503 504 /50x.html; location = /50x.html { root html; } } # 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; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
    转载请注明原文地址: https://ju.6miu.com/read-2179.html

    最新回复(0)