nginx将泛解析的匹配域名绑定到子目录配置方法
生活随笔
收集整理的這篇文章主要介紹了
nginx将泛解析的匹配域名绑定到子目录配置方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
應用場景:
http://zzl.lteam.cn/ 訪問/usr/local/boke/lteam.cn/zzl 目錄下的 index.html
http://lj.lteam.cn/ 訪問/usr/local/boke/lteam.cn/lj 目錄下的 index.html
目錄結構:
/usr/local/boke/
├── lteam.cn
│ └── zzl
│ ├── index.html
│ └── lj
│ ├── index.html
nginx配置:
server {listen 80;server_name *.lteam.cn;#charset koi8-r;#access_log logs/host.access.log main;if ($host ~* ^([^\.]+)\.([^\.]+\.[^\.]+)$) {set $subdomain $1;set $domain $2;}location / {# root html;# index index.html index.htm;root /usr/local/boke/$domain/$subdomain;index index.html;}}
總結
以上是生活随笔為你收集整理的nginx将泛解析的匹配域名绑定到子目录配置方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: sql移除数据中的换行符和回车符
- 下一篇: SpringBoot (二) :全局异常