Nginx config 文件

一般修改文件之前,先下载到本地的电脑上,否则容易写错。改完再上传。

从vps下载conf(centos)

sz /path/to/file

上传

rz

如果报错则先下载

1
yum -y install lrzsz

我的文件

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
26
27
28
29
30
31
32
33
34
35
36
37
38
#user  nobody;
worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
listen 443 ssl;
server_name www.domain.com;
# return 301 https://$server_name$request_uri; #这里不知道为什么老出错
index index.html index.htm index.php;
root /var/www/blog;
access_log /usr/local/nginx/logs/access.log;
error_log /usr/local/nginx/logs/error.log;
ssl_certificate /etc/letsencrypt/live/www.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.domain.com/privkey.pem;

location / {
root /var/www/blog; # 这里写你的静态文件目录
index index.html index.htm; # 这里写你暴露的静态文件
}
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /var/www/blog; # 这里写你的静态文件目录
}
location = /.well-known/acme-challenge/ {
return 404;
}
}
}

----本文结束啦感谢您阅读----

欢迎关注我的其它发布渠道