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;

}

}

}

相关推荐
(:满天星:)4 小时前
第31篇:块设备与字符设备管理深度解析(基于OpenEuler 24.03)
linux·运维·服务器·网络·centos
小陶来咯4 小时前
【仿muduo库实现并发服务器】Acceptor模块
运维·服务器
cui_hao_nan4 小时前
Docker后端部署
运维·docker·容器
ZZH1120KQ5 小时前
Linux系统安全及应用
linux·运维·系统安全
小扎仙森5 小时前
关于服务器宝塔转移wordperss子比主题问题
运维·服务器
小小小糖果人5 小时前
Linux云计算基础篇(5)
linux·运维·服务器
我不是哆啦A梦5 小时前
破解风电运维“百模大战”困局,机械版ChatGPT诞生?
运维·人工智能·python·算法·chatgpt
weixin_7714323116 小时前
linux系统 weblogic10.3.6(jar) 下载及安装
linux·运维·jar
绝不偷吃6 小时前
FastDFS分布式储存
linux·nginx
scuter_yu6 小时前
主流零信任安全产品深度介绍
运维·网络·安全