简单纪要:nginx配置

Posted rnan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了简单纪要:nginx配置相关的知识,希望对你有一定的参考价值。

/export/servers/nginx/conf/domains/ test1.jd.local

upstream tomcat_live1 {
server 127.0.0.1:1601 weight=10 max_fails=2 fail_timeout=30s ;

}

server {
listen 80;
server_name nihao.local nihao.com  127.0.0.1;
access_log /export/servers/nginx/logs/test1.jd.local/test1.jd.local_access.log main;
error_log /export/servers/nginx/logs/test1.jd.local/test1.jd.local_error.log warn;


error_page 411 = @my_error;

location @my_error {
}
root /export/Packages/vd-live-web/latest/;

location / {
add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Methods ‘GET, POST, OPTIONS‘;
add_header Access-Control-Allow-Headers ‘DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization‘;
add_header Access-Control-Allow-Credentials true;
proxy_next_upstream http_500 http_502 http_503 http_504 error timeout invalid_header;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://tomcat_live1;
include /export/servers/nginx/conf/error/error_location.conf;
expires 0;
}

location ~ ^/(monitor|resources)/* {
proxy_pass http://127.0.0.1:1601;
include /export/servers/nginx/conf/error/error_location.conf;
}

location /logs/ {
autoindex off;
deny all;
}
location /l/uploadCoverPC {
log_not_found off;
}
include /export/servers/nginx/conf/error/error.conf;
}

以上是关于简单纪要:nginx配置的主要内容,如果未能解决你的问题,请参考以下文章

nginx常用命令及简单配置

nginx结合vue+node简单配置

Nginx的简单配置

Nginx简单配置

nginx配置文件简单介绍

Nginx简单配置及测试