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;

}

}

}

相关推荐
j7~7 小时前
【Linux网络加餐(二)】《进程组,会话,控制终端,作业控制和守护进程》---详解
linux·运维·服务器·守护进程·会话·进程组·控制终端
名字还没想好☜7 小时前
Docker 数据卷实战:volume、bind mount、tmpfs 到底怎么选,数据持久化与权限坑
运维·docker·容器·kubernetes
天道jimmy7 小时前
VulnHub 系列:Prime,1
linux·运维·服务器
Lumistory7 小时前
从OPPO长安研发中心看头部科技企业的照明运维选择
大数据·运维·人工智能·光照贴图
好评1248 小时前
【Linux】数据链路层
linux·运维·网络
新时代牛马9 小时前
Linux 信号处理完整篇:从sigaction、掩码到内核发送与可重入排障
linux·运维·信号处理
lpfasd1239 小时前
Docker存储清理与防膨胀实践
运维·docker·容器
每天被AI救一次9 小时前
WorkBuddy 会议自动化实战:从腾讯会议转写到待办系统的完整链路(附全套提示词)
运维·自动化·腾讯会议
程序员梅雨9 小时前
Linux & Shell 实用干货
linux·运维·服务器·后端·面试·php
吴声子夜歌9 小时前
编写Shell脚本——自顶向下设计
linux·运维·shell