nginx-配置记录
Posted 腾信软创
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx-配置记录相关的知识,希望对你有一定的参考价值。
贴一个用过的nginx的配置,不包含https的配置
upstream front{ server 127.0.0.1:8080 weight=10; } upstream admin{ server 127.0.0.1:8090 weight=5; } upstream admin2{ server 127.0.0.1:8091 weight=5; } upstream front2{ server 127.0.0.1:8100 weight=5; } upstream front3{ server 127.0.0.1:8110 weight=5; } server { listen 80; underscores_in_headers on; server_name 域名; rewrite ^(.*)/front/(.*) http://域名/front2/$2 redirect; index index.jsp index.htm index.php; client_max_body_size 1000m; fastcgi_connect_timeout 75; fastcgi_read_timeout 600; fastcgi_send_timeout 600; keepalive_timeout 600; proxy_connect_timeout 600; proxy_read_timeout 600; location /front/ { proxy_redirect off; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://front2; } location /admin/ { proxy_redirect off; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://admin; } location /admin2/ { proxy_redirect off; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://admin2; } location /front2/ { proxy_redirect off; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://front2; } location /front3/ { proxy_redirect off; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://front; } location ^~ /front/upload/{ alias /data/upload/; access_log off; expires 5d; } location ^~ /admin/upload/{ alias /data/upload/; access_log off; expires 5d; } location ^~ /front2/upload/{ alias /data/upload/; access_log off; expires 5d; } location ^~ /front3/upload/{ alias /data/upload/; access_log off; expires 5d; } location ^~ /MP_verify_29oSzr2bnZTqaOmk.txt{ alias /data/upload/MP_verify_29oSzr2bnZTqaOmk.txt; access_log off; expires 5d; } }
以上是关于nginx-配置记录的主要内容,如果未能解决你的问题,请参考以下文章
Nginx——Nginx启动报错Job for nginx.service failed because the control process exited with error code(代码片段