forked from linwu-hi/coding-time
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
52 lines (50 loc) · 2.12 KB
/
nginx.conf
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
server {
#SSL 默认访问端口号为 443
listen 443 ssl;
#请填写绑定证书的域名
server_name www.coding-time.cn;
#请填写证书文件的相对路径或绝对路径
ssl_certificate /etc/nginx/coding-time.cn_bundle.crt;
#请填写私钥文件的相对路径或绝对路径
ssl_certificate_key /etc/nginx/coding-time.cn.key;
ssl_session_timeout 5m;
#请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
#请按照以下协议配置
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
# location ^~ /md {
# proxy_pass http://43.138.235.240:8081;
# }
location / {
#网站主页路径。此路径仅供参考,具体请您按照实际目录操作。
#例如,您的网站主页在 Nginx 服务器的 /etc/www 目录下,则请修改 root 后面的 html 为 /etc/www。
root /usr/share/nginx/html; # nginx的静态资源目录
index index.html index.htm;
try_files $uri $uri/ /index.html; # 对于 Vue 或 React项目使用history路由需要
}
# location /md {
# proxy_pass http://localhost:8081;
# }
}
server {
listen 80;
#请填写绑定证书的域名
server_name www.coding-time.cn;
#charset koi8-r;
access_log /var/log/nginx/host.access.log main;
error_log /var/log/nginx/error.log error;
# location ^~ /md {
# proxy_pass http://43.138.235.240:8081;
# }
location / {
root /usr/share/nginx/html; # nginx的静态资源目录
index index.html index.htm;
try_files $uri $uri/ /index.html; # 对于 Vue 或 React项目使用history路由需要
}
# location /md {
# proxy_pass http://localhost:8081;
# }
#把http的域名请求转成https
return 301 https://$host$request_uri;
}