Fix nginx rewrite rules to be compatible with external folders

실제 폴더가 있는 경우 mid로 인식하지 않도록 변경함.
라이믹스와 별도로 사용중인 다른 폴더가 있는 경우 유용함.
아파치 .htaccess에는 이미 해당 기능이 들어 있었음.

https://xetown.com/qna/1088212
This commit is contained in:
Kijin Sung 2018-10-09 09:56:05 +09:00
parent 5b60da6f62
commit a5e779866b
2 changed files with 6 additions and 8 deletions

View file

@ -2,9 +2,6 @@
location ~ ^/rhymix/modules/editor/(skins|styles)/.+\.html$ {
# pass
}
location ~ ^/rhymix/common/manual/.+\.html$ {
# pass
}
location ~ ^/rhymix/(addons|common/tpl|files/ruleset|(m\.)?layouts|modules|plugins|themes|widgets|widgetstyles)/.+\.(html|xml)$ {
return 403;
}
@ -46,7 +43,9 @@ rewrite ^/rhymix/([a-zA-Z0-9_]+)/category/([0-9]+)$ /rhymix/index.php?mid=$1&cat
rewrite ^/rhymix/([0-9]+)$ /rhymix/index.php?document_srl=$1 last;
# mid link
rewrite ^/rhymix/([a-zA-Z0-9_]+)/?$ /rhymix/index.php?mid=$1 last;
location ~ ^/rhymix/([a-zA-Z0-9_]+)/?$ {
try_files $uri $uri/ /rhymix/index.php?mid=$1;
}
# mid + document link
rewrite ^/rhymix/([a-zA-Z0-9_]+)/([0-9]+)$ /rhymix/index.php?mid=$1&document_srl=$2 last;

View file

@ -2,9 +2,6 @@
location ~ ^/modules/editor/(skins|styles)/.+\.html$ {
# pass
}
location ~ ^/common/manual/.+\.html$ {
# pass
}
location ~ ^/(addons|common/tpl|files/ruleset|(m\.)?layouts|modules|plugins|themes|widgets|widgetstyles)/.+\.(html|xml)$ {
return 403;
}
@ -46,7 +43,9 @@ rewrite ^/([a-zA-Z0-9_]+)/category/([0-9]+)$ /index.php?mid=$1&category=$2 last;
rewrite ^/([0-9]+)$ /index.php?document_srl=$1 last;
# mid link
rewrite ^/([a-zA-Z0-9_]+)/?$ /index.php?mid=$1 last;
location ~ ^/([a-zA-Z0-9_]+)/?$ {
try_files $uri $uri/ /index.php?mid=$1;
}
# mid + document link
rewrite ^/([a-zA-Z0-9_]+)/([0-9]+)$ /index.php?mid=$1&document_srl=$2 last;