惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
D
Docker
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
美团技术团队
V
V2EX
Last Week in AI
Last Week in AI
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
Microsoft Security Blog
Microsoft Security Blog
Microsoft Azure Blog
Microsoft Azure Blog
人人都是产品经理
人人都是产品经理
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
B
Blog RSS Feed
博客园_首页
B
Blog
博客园 - 叶小钗
I
InfoQ
WordPress大学
WordPress大学
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
The GitHub Blog
The GitHub Blog
The Register - Security
The Register - Security
MyScale Blog
MyScale Blog
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
Latest news
Latest news
W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
C
CXSECURITY Database RSS Feed - CXSecurity.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
N
News and Events Feed by Topic
S
Secure Thoughts
The Hacker News
The Hacker News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News

web 服务器 on 打工人日志

使用TLSv1.3 升级nginx和openssl nginx 配置和编译 nginx ssh-key connection exception nginx 编译参数详解 nginx 重写规则 rewrite模块 nginx 日志格式整理 nginx 汇总
nginx.conf 配置文件详解
2021-12-24 · via web 服务器 on 打工人日志

nginx.conf 配置文件详解

 1# vim nginx.conf
 2user nobody nobody; # 运行 nginx 的所属组和所有者
 3worker_processes 2; # 开启两个 nginx 工作进程,一般几个 CPU 核心就写几
 4error_log logs/error.log notice; # 错误日志路径
 5pid logs/nginx.pid; # pid 路径
 6
 7events
 8{
 9    worker_connections 1024; # 一个进程能同时处理 1024 个请求
10}
11
12http
13{
14    include mime.types;
15    default_type application/octet-stream;
16
17    log_format main ‘$remote_addr$remote_user [$time_local]$request” ‘
18$status $body_bytes_sent$http_referer” ‘
19    ‘”$http_user_agent” “$http_x_forwarded_for”‘;
20    access_log logs/access.log main; # 默认访问日志路径
21    sendfile on;
22    keepalive_timeout 65; # keepalive 超市时间
23    # 开始配置一个域名,一个 server 配置段一般对应一个域名
24    server
25    {
26        listen 80; #
27        # 在本机所有 ip 上监听 80,也可以写为 192.168.1.202:80,这样的话,就只监听 192.168.1.202 上的 80 口
28        server_name www.nbtyfood.com; # 域名
29        root /www/html/www.nbtyfood.com; # 站点根目录(程序目录)
30        index index.html index.htm; # 索引文件
31        location /
32        { # 可以有多个 location
33            root /www/html/www.nbtyfood.com; # 站点根目录(程序目录)
34        }
35        error_page 500 502 503 504 /50x.html;
36        # 定义错误页面,如果是 500 错误,则把站点根目录下的 50x.html 返回给用户
37        location = /50x.html {
38        root /www/html/www.nbtyfood.com;
39        }
40    }
41# 开始配置站点 bbs.nbtyfood.com
42    server
43    {
44        listen 80;
45        server_name bbs.nbtyfood.com;
46        root /www/html/bbs.nbtyfood.com;
47        index index.html index.htm; # 索引文件
48        location /
49        {
50            root /www/html/bbs.nbtyfood.com;
51        }
52        error_page 500 502 503 504 /50x.html;
53        location = /50x.html {
54            root /www/html/bbs.nbtyfood.com;
55        }
56    }
57}