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;

}

}

}

相关推荐
SAP工博科技5 小时前
SAP 公有云 ERP 多工厂多生产线数据统一管理技术实现解析
大数据·运维·人工智能
YongCheng_Liang5 小时前
从零开始学虚拟化:桌面虚拟化(VDI)入门指南(架构 + 产品 + 部署)
运维·云计算
杜子不疼.5 小时前
【Linux】库制作与原理(二):动态库的制作与使用
linux·运维·服务器
消失的旧时光-19435 小时前
Nginx 是什么?为什么它不写在代码里?——从 0 认识 Nginx
运维·服务器·nginx
BJ_Bonree5 小时前
4月17日,博睿数据受邀出席GOPS全球运维大会2026 · 深圳站!
大数据·运维·人工智能
RisunJan5 小时前
Linux命令-lpq(查看打印队列状态)
linux·运维·服务器
山君爱摸鱼6 小时前
Linux-服务进程
linux·运维·服务器
阿乐艾官6 小时前
【linux文件系统重要目录及命令解释】
linux·运维·服务器
senijusene6 小时前
Linux软件编程: Linux 操作系统基础与shell脚本
linux·运维·chrome
乾元6 小时前
身份与访问:行为生物识别(按键习惯、移动轨迹)的 AI 建模
运维·网络·人工智能·深度学习·安全·自动化·安全架构