nginx localtion 的alias是一个目录别名的定义,root则是最上层目录的定义


server {
listen 443 ssl;
server_name testmall.xxxx.com;

ssl_certificate server.crt;
ssl_certificate_key server.key;
ssl_protocols TLSv1.2;
ssl_ciphers ‘AES128+EECDH:AES128+EDH’;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
charset utf-8;

proxy_connect_timeout 180;
proxy_send_timeout 180;
proxy_read_timeout 180;
proxy_set_header Host $host;
proxy_set_header X-Forwarder-For $remote_addr;

root /home/nginx2/html;

location / {
try_files $uri $uri/ /index.html;
}

location ^~ /admin {
try_files $uri $uri/ /admin/index.html;
}

location ^~ /store {
try_files $uri $uri/ /store/index.html;
}

location ^~ /mobile {
try_files $uri $uri/ /mobile/index.html;
}

location ^~ /devmobile {
try_files $uri $uri/ /devmobile/index.html;
}

 

 

location ^~ xxx/mobile {
proxy_redirect off;
alias /home/nginx2/h5/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Scheme $scheme;
}

原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/274329.html

(0)
上一篇 2022年7月14日
下一篇 2022年7月14日

相关推荐

发表回复

登录后才能评论