nginx 짧은주소 사용을 활성화 시키려고 했는데 잘 안되네요.
CMS/프레임워크 | Rhymix 1.9 |
---|---|
개발 언어 | PHP 7.1 |
/etc/nginx 디릭토리에
# block direct access to templates, XML schemas, config files, dotfiles, environment info, etc.
location ~ ^/modules/editor/(skins|styles)/.+\.html$ {
# pass
}
location ~ ^/(addons|common/tpl|files/ruleset|(m\.)?layouts|modules|plugins|themes|widgets|widgetstyles)/.+\.(html|xml)$ {
return 403;
}
location ~ ^/files/(attach|config|cache/store)/.+\.(ph(p|t|ar)?[0-9]?|p?html?|cgi|pl|exe|[aj]spx?|inc|bak)$ {
return 403;
}
location ~ ^/files/(env|member_extra_info/(new_message_flags|point))/ {
return 403;
}
location ~ ^/(\.git|\.ht|\.travis|codeception\.|composer\.|Gruntfile\.js|package\.json|CONTRIBUTING|COPYRIGHT|LICENSE|README) {
return 403;
}
# fix incorrect relative URLs (for legacy support)
location ~ ^/(.+)/(addons|files|layouts|m\.layouts|modules|widgets|widgetstyles)/(.+) {
try_files $uri $uri/ /$2/$3;
}
# fix incorrect minified URLs (for legacy support)
location ~ ^/(.+)\.min\.(css|js)$ {
try_files $uri $uri/ /$1.$2;
}
# rss, blogAPI
rewrite ^/(rss|atom)$ /index.php?module=rss&act=$1 last;
rewrite ^/([a-zA-Z0-9_]+)/(rss|atom|api)$ /index.php?mid=$1&act=$2 last;
# trackback
rewrite ^/([0-9]+)/(.+)/trackback$ /index.php?document_srl=$1&key=$2&act=trackback last;
rewrite ^/([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ /index.php?mid=$1&document_srl=$2&key=$3&act=trackback last;
# administrator page
rewrite ^/admin/?$ /index.php?module=admin last;
# document category
rewrite ^/([a-zA-Z0-9_]+)/category/([0-9]+)$ /index.php?mid=$1&category=$2 last;
# document permanent link
rewrite ^/([0-9]+)$ /index.php?document_srl=$1 last;
# mid link
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;
# mid + entry title
rewrite ^/([a-zA-Z0-9_]+)/entry/(.+)$ /index.php?mid=$1&entry=$2 last;
를 rhymix-nginx.conf로 저장 후
/etc/nginx/conf.d에 있는 default.conf에
server {
server_name fcseoulite.me;
root /usr/share/nginx/html;
index index.html index.php;
include /etc/nginx/rhymix-nginx.conf;
client_max_body_size 32m;
location / {
index index.php index.html;
}
include snippets/rhymix.conf;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param HTTPS on;
include fastcgi_params;
}
위와같이 rhymix-nginx.conf를 include 했는데 여전히 짧은주소 대신 긴 주소가 나오네요 ㅠ
혹시 제가 뭘 잘못한건지,,
include를 include snippets/rhymix.conf; 위에 넣어줘야 할까요?
댓글 7
include snippets/rhymix.conf; 이건 뭔가요? 이미 있는데 중복으로 설정하고 계신 것 아닌가요?
짧은주소는 시스템 설정 → 고급 설정 화면에서 켤 수 있습니다. 라이믹스 관리자 화면에서 짧은주소를 켜지 않으면 nginx에서 뭔 짓을 해도 소용없습니다. nginx 설정은 원상복구하고, 라이믹스 관리자 화면부터 들어가 보세요.
include snippets/rhymix.conf;이 예전부터 있었고, 저기에 분명히 짧은주소로 바꾸는 문구가 들어가 있는데도 시스템 설정에서 짧은주소를 활성화 시켜도 계속 짧은주소로 변하지 않아서 따로 설정을 만들었습니다. 어떻게 해야할지 잘 모르겠네요..ㅠ
짧은주소로 링크가 생성되지 않는 것은 라이믹스 쪽에서 뭔가 설정이 잘못된 것입니다. nginx와는 아무 관련이 없습니다. nginx에서는 짧은주소든 긴주소든 어떤 링크도 생성하지 않습니다. 이미 생성된 링크로 접속했을 때 어떻게 처리할지 결정할 뿐입니다. 애당초 링크를 생성하는 것은 라이믹스 코어입니다.
만약 짧은주소로 링크가 생성되었는데 클릭해 보니 404 에러가 나온다면 그 때 nginx 설정을 살펴보시면 됩니다.