nginx配置

nginx报错

1
2
3
# nginx
2023/11/13 08:36:38 [error] 1399#1399: open() "/run/nginx.pid" failed (2: No such file or directory)

解决方法:
在配置文件中配置

1
2
# nginx.conf
pid logs/nginx.pid;

并新建文件夹和文件

nginx配置ipv6

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# nginx.conf
server {
listen 80;
listen [::]:80;
return 301 https://$host$request_uri;
}
server {
# 配置域名
server_name nb.waol.tk;

# https默认端口
listen [::]:443 ssl;
listen 443 ssl;
ssl_certificate fullchain.pem;
ssl_certificate_key privkey.pem;
root /blog/public;
index index.php index.html index.htm;
}

server {
if ($host = practi.tk) {
return 301 https://$host$request_uri;
}
}

电信ipv6的80端口被封

网络改桥接后80端口依然被封

windows下nginx配置

管理员权限启动powershell,运行nginx,同意通过防火墙