二级域名nginx 配置
访问地址 http://二级域名称.域名名称.com/
server {
listen 80;
server_name 二级域名称.一级域名xxxxx.com;
location / {
proxy_pass http://localhost:8282;
}
}
server{
listen 8282;
server_name localhost;
location / {
root /home/ncyh_lkjp/web/dist; //前端部署地址
try_files $uri $uri/ /index.html;
index index.html index.html;
}
location /prod-api/ { // 后端服务接口前缀
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:9080/; // 后端服务器端口号
}
}
证书配置:
server{
listen 443 ssl;
server_name 二级域名称.一级域名xxxxx.com;
charset utf-8;
#证书配置
ssl_certificate conf.d/cert/一级域名xxxxx.com.pem;
ssl_certificate_key conf.d/cert/一级域名xxxxx.com.key;
ssl_session_timeout 5m;
ssl_ciphers xxxx;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
root /home/rn_gsgl/web/dist; //前端部署地址
try_files $uri $uri/ /index.html;
index index.html index.html;
}
location /prod-api/ { // 后端服务接口前缀
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8484/; // 后端服务器端口号
}
access_log /home/xxx.log;
}