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
| http {
server {
listen 80;
server_name www.ddd.com; # 你的域名
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name www.ddd.com; # 你的域名 include /etc/nginx/default.d/*.conf;
add_header Access-Control-Allow-Origin '*'; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, PUT, DELETE'; add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization, X-Total-Count'; add_header Access-Control-Expose-Headers 'X-Total-Count'; ssl_certificate /etc/cert/server.crt; # 证书位置
ssl_certificate_key /etc/cert/server.key; # 证书位置 charset utf-8; # 添加这行来指定编码
location / { # 对于css文件解析进行配置 include mime.types; default_type application/octet-stream;
root /etc/nginx/html/dist; # 静态页面目录
index index.html; # 静态页面名字
} error_page 404 /404.html; location = /404.html { }
error_page 500 502 503 504 /50x.html; location = /50x.html { } } }
|