Nginx教程

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

本文主要是介绍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;
}

这篇关于nginx localtion 的alias是一个目录别名的定义,root则是最上层目录的定义的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!