Created
November 27, 2018 07:48
-
-
Save jingmian/c0c758cfe1f2fb897d3171451a4ac088 to your computer and use it in GitHub Desktop.
lnmp配置二级图片域名
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vim /usr/local/nginx/vhost/img.conf | |
server{ | |
listen 80; | |
server_name img.xxx.net; | |
set $root '/home/wwwroot/tpAdmin/static/'; | |
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ | |
{ | |
root $root; | |
expires 7d; | |
} | |
root $root; | |
index index.html; | |
if ($time_iso8601 ~ '(\d{4}-\d{2}-\d{2})') { | |
set $today $1; | |
} | |
access_log /home/wwwlogs/img/$today.log; | |
} | |
#配置主网站 | |
vim /usr/local/nginx/vhost/tpadmin.conf | |
server{ | |
listen 8089; | |
set $root '/home/wwwroot/tpAdmin'; | |
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ | |
{ | |
root $root; | |
} | |
root $root; | |
index index.html index.php; | |
include enable-php-pathinfo.conf; | |
location / { | |
if (!-e $request_filename) { | |
rewrite ^(.*)$ /index.php?s=$1 last; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment