1.配置静态资源
server {
listen 80;
server_name localhost;
rewrite ^(.*) https://$server_name$1 permanent;
#charset koi8-r;
#access_log logs/host.access.log main;
#location / {
#proxy_pass http://hello; #在这里设置一个代理,和upstream的名字一样
#root html;
#index index.html index.htm;
#}
location /app/ {
root /app/war/hospital;
index index.html;
}
}
2. // 将静态资源放入/app/war/hospital 对应目录

3.nginx 配置https配置
server {
listen 443 ssl;
server_name localhost;
root html;
index index.html index.htm;
ssl_certificate 对应证书的crt;
ssl_certificate_key 对应证书的key;
location / {
proxy_pass http://localhost:8080/;
}
}
本文介绍如何使用Nginx配置静态资源路径及HTTPS,包括将HTTP重定向到HTTPS,设置静态资源目录,以及配置SSL证书。适用于网站安全升级和优化。
1万+

被折叠的 条评论
为什么被折叠?



