XE 1.8.37 대비 nginx rewrite rule
# nginx configuration
location ~ ^/(.*/)?\.(editor|git|ht|jshint|travis) {
return 403;
}
location ~ ^/(codeception(.*)\.yml|composer(.*)\.(json|lock)|package\.json)$ {
return 403;
}
location ~ ^/files/(attach|config|cache/store)/.+\.php$ {
return 403;
}
location ~ ^/files/(env|member_extra_info/(new_message_flags|point))/ {
return 403;
}
location ~ ^/(layouts|m.layouts|files/faceOff)/(.+)\.html$ {
return 403;
}
location /modules/editor/ {
}
location ~ /(skins|m.skins)/(.+)\.html$ {
return 403;
}
location /modules {
rewrite ^(.*)$ /index.php break;
}
location /addons {
rewrite ^(.*)$ /index.php break;
}
location /widgets {
rewrite ^(.*)$ /index.php break;
}
location / {
if ($script_filename !~ "-f"){
rewrite ^/(.+)/files/(member_extra_info|attach|cache|faceOff)/(.*) /files/$2/$3 break;
}
if ($script_filename !~ "-f"){
rewrite ^/(.+)/(files|modules|widgets|widgetstyles|layouts|m.layouts|addons)/(.*) /$2/$3 break;
}
rewrite ^/([a-zA-Z0-9_]+)/(rss|atom|api)$ /index.php?mid=$1&act=$2 break;
rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/(rss|atom|api)$ /index.php?vid=$1&mid=$2&act=$3 break;
rewrite ^/([0-9]+)/(.+)/trackback$ /index.php?document_srl=$1&key=$2&act=trackback break;
rewrite ^/([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ /index.php?mid=$1&document_srl=$2&key=$3&act=trackback break;
rewrite ^/([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ /index.php?vid=$1&document_srl=$2&key=$3&act=trackback break;
rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ /index.php?vid=$1&mid=$2&document_srl=$3&key=$4&act=trackback break;
rewrite ^/([0-9]+)$ /index.php?document_srl=$1 break;
if ($script_filename !~ "-d"){
rewrite ^/([a-zA-Z0-9_]+)/?$ /index.php?mid=$1 break;
}
rewrite ^/([a-zA-Z0-9_]+)/([0-9]+)$ /index.php?mid=$1&document_srl=$2 break;
if ($script_filename !~ "-d"){
rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/?$ /index.php?vid=$1&mid=$2 break;
}
rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)$ /index.php?vid=$1&mid=$2&document_srl=$3 break;
rewrite ^/([a-zA-Z0-9_]+)/entry/(.+)$ /index.php?mid=$1&entry=$2 break;
rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/entry/(.+)$ /index.php?vid=$1&mid=$2&entry=$3 break;
if ($script_filename !~ "-f"){
rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9_\.-]+)$ /index.php?act=route&vid=$1&type=$2&identifier=$3 break;
}
}
location /rss {
rewrite ^/(rss|atom)$ /index.php?module=rss&act=$1 break;
}
location /atom {
rewrite ^/(rss|atom)$ /index.php?module=rss&act=$1 break;
}
댓글 2
변경하지 않는다고 XE 1.8.37에서 딱히 문제가 생기는 건 아니고요, 일부 문제를 일으킬 소지가 있는 경로에 대한 접근을 제한한 것 뿐입니다.
지금 XE에서 배포하는 rewrite 규칙들도 부족한 점이 많으므로 nginx용으로 만들 때 굳이 100% 동일하게 번역할 필요는 없습니다. if 사용은 자제하고, 접근을 제한하면 될 것을 불필요하게 index.php로 rewrite하는 것도 피하세요. 특히 modules, addons, widgets 등을 일괄적으로 막는 것은 문제가 발생할 소지가 많아 보입니다.
라이믹스 rewrite 규칙을 참고하세요.