nginx.conf 文件配置

#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 gateway {

server IP1;

server IP2;

}

server {

listen 8010;

server_name localhost;

#charset koi8-r;

server_tokens off;

add_header X-Frame-Options DENY;

add_header Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval' blob: data: ;";

add_header X-Xss-Protection "1;mode=block";

add_header X-Content-Type-Options nosniff;

#access_log logs/host.access.log main;

###日志按天分割

if ($time_iso8601 ~ '(\d{4}-\d{2}-\d{2})'){

set $ttt $1;

}

limit_req zone=allips burst=2 nodelay;

access_log logs/access.$ttt.log;

error_log logs/error.log;

###日志结束

location / {

root /app/code; #项目路径

index index.html index.htm;

}

location ^~/api/ {

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-NginX-Proxy true;

proxy_pass http://gateway/;

}

#error_page 404 /404.html;

redirect server error pages to the static page /50x.html

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

}

}

相关推荐
TO_ZRG17 分钟前
使用jenkins打包unity工程
运维·unity·jenkins
liujiangxu23 分钟前
jenkins声明式流水线语法详解
运维·自动化·jenkins
guoguoqiang.1 小时前
我与Linux的爱恋:命令行参数|环境变量
linux·运维·服务器·c语言·学习
客观花絮说2 小时前
DSC+DW实时+异步搭建部署
运维
x66ccff2 小时前
【linux】4张卡,坏了1张,怎么办?
linux·运维·服务器
我命由我123454 小时前
GPIO 理解(基本功能、模拟案例)
linux·运维·服务器·c语言·c++·嵌入式硬件·c#
kka杰4 小时前
Linux 进程3
linux·运维·服务器
华纳云IDC服务商4 小时前
网站服务器怎么计算同时在线人数?
运维·服务器
没有名字的小羊4 小时前
Linux基础命令——账户简单管理
linux·运维·服务器·网络·数据库
smile_life_4 小时前
服务器非法关闭后MySQL服务启动失败
运维·服务器·mysql