screenshot-to-code/frontend/conf.d/default.conf
2024-09-07 22:21:41 +08:00

54 lines
2.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# web前台部署
server {
listen 443 ssl;
server_name huyinfu.space;
location / {
root /usr/share/nginx/frontend/; # dist文件挂载到容器的目录
try_files $uri $uri/ /index.html;
index index.html;
}
# 如下SSL配置
# 配置HTTPS的默认访问端口为443。
# 如果未在此处配置HTTPS的默认访问端口可能会造成Nginx无法启动。
# 如果您使用Nginx 1.15.0及以上版本请使用listen 443 ssl代替listen 443和ssl on。
ssl_certificate /etc/nginx/conf.d/web_certs/huyinfu.space.pem; # 需要将cert-file-name.pem替换成已上传的证书文件的名称。
ssl_certificate_key /etc/nginx/conf.d/web_certs/huyinfu.space.key; # 需要将cert-file-name.key替换成已上传的证书密钥文件的名称。
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
# 表示使用的加密套件的类型。
ssl_protocols TLSv1.1 TLSv1.2; # 表示使用的TLS协议的类型。
ssl_prefer_server_ciphers on;
}
server {
listen 80;
server_name huyinfu.space; #需要将yourdomain替换成证书绑定的域名。
rewrite ^(.*)$ https://$host$1; #将所有HTTP请求通过rewrite指令重定向到HTTPS。
location / {
index index.html index.htm;
}
}
# 后端部署
server {
listen 443 ssl;
server_name api.huyinfu.space;
# 配置HTTPS的默认访问端口为443。
# 如果未在此处配置HTTPS的默认访问端口可能会造成Nginx无法启动。
# 如果您使用Nginx 1.15.0及以上版本请使用listen 443 ssl代替listen 443和ssl on。
ssl_certificate /etc/nginx/conf.d/api_certs/api.huyinfu.space.pem; # 需要将cert-file-name.pem替换成已上传的证书文件的名称。
ssl_certificate_key /etc/nginx/conf.d/api_certs/api.huyinfu.space.key; # 需要将cert-file-name.key替换成已上传的证书密钥文件的名称。
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
# 表示使用的加密套件的类型。
ssl_protocols TLSv1.1 TLSv1.2; # 表示使用的TLS协议的类型。
ssl_prefer_server_ciphers on;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://huyinfu.space:7001/;
}
}