CMS솔루션마켓, 이온디 - 워드프레스, 라이믹스, 카페24, 그누보드, 엑셀

웹기술을 같이 공유합니다

XE에서 라이믹스로 업그레이드 후 카테고리 선택시 '대상을 찾을 수 없습니다'라는 오류가 발생합니다.

이는 XE와 설정 파일 구문이 다르기 때문입니다.

이에, 라이믹스에서는 깃헙으로 Nginx 서버 용 conf 파일을 제공하고 있습니다.


라이믹스용 nginx 설정파일

https://github.com/rhymix/rhymix/blob/master/common/manual/server_config/rhymix-nginx.conf


# 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;
}


# fix download URL when other directives for static files are present
location ~ ^/files/download/ {
    try_files $uri $uri/ /index.php$is_args$args;
}


# all other short URLs
location / {
    try_files $uri $uri/ /index.php$is_args$args;
}


위 코드를 플래스크 사용자 화면에서 추가가 가능합니다. (그런데 문제가 있습니다만 일단 설명부터 하겠습니다.)


위치 : Plesk 관리자 > 도메인 > 도메인 선택 > Apache & nginx 설정 

추가 nginx 지시문에 위 깃헙에서 공유된 코드를 넣으면 됩니다만,

짧은 주소 부분은 바로 이 부분입니다.

# all other short URLs
location / {
try_files $uri $uri/ /index.php$is_args$args;
}

그런데 위 코드를 추가 nginx 지시문 부분에 넣으면 오류가 발생합니다.


잘못된 nginx 구성 : nginx: [emerg] duplicate locaion "/" in ....
/var/www/vhosts/system/eond.com/conf/vhosts_nginx.conf:2 nginx: configuration file
/etc/nginx/nginx.conf test failed

해당 경로 nginx 파일에서 location "/" 부분이 중복이라고 나옵니다.

실제 해당 파일에서는 이미 location / 부분이 존재했습니다. 그래서 안타깝게도 쉽게 플래스크에서 바로 NGINX 설정을 추가해줄 수는 없었습니다. ㅠ

하지만 저 부분에 입력한 코드는 vhost_nginx.conf 파일에 기록이 됩니다.

include /var/www/vhosts/system/eond.com/conf/rhymix-nginx.conf;

이렇게 입력해도 중복이라고 뜨더군요. -_-;

어쩔 수 없이 터미널을 열고 nginx.conf 파일을 수정 후 nginx 를 리로드해줬습니다.


NGINX 설정파일 수정

vi nginx.conf


NGINX 서버 설정 리로드

service nginx reload

그런데 말입니다.

문제는 서버를 재시작하면 발생합니다.

사실 저 nginx.conf 파일 상단에는 무시무시한 문구가 있었는데 말입죠....


#ATTENTION!

#

#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,

#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

...


맞습니다. 수정을 하면 안됩니다. 사실.. 

저 파일은 자동으로 생성되기 때문입니다.

결국 가능한건 아래가 전부였습니다. ㅠㅠ


# fix incorrect relative URLs (for legacy support)  

이 부분도 결국 추가를 하니 이미지 경로나 css를 제대로 불러오지 못해서 추가를 못했습니다.


wildcards 폴더에서 새로운 eond.conf 를 만들어 넣는다거나...ㅠㅠ 

아직은 도저히 방법을 모르겠네요. ㅠㅠㅠ


해결방법 찾았습니다!;

https://support.plesk.com/hc/en-us/articles/213912945


location / {
try_files $uri $uri/ /index.php?$args;
}


위 코드를 아래로 수정하면 됩니다.


location ~ / {
index index.php index.cgi index.pl index.html index.xhtml index.htm index.shtml;
try_files $uri $uri/ /index.php?$args;
}


다른 부분은 해결됐는데 아래 코드를 집어넣으면 게시판에 첨부한 이미지가 로딩이 안되던데, 

혹시 이 부분도 원인을 알 수 있을까요?


# fix incorrect relative URLs (for legacy support)
location ~ ^/(.+)/(addons|files|layouts|m\.layouts|modules|widgets|widgetstyles)/(.+) {
    try_files $uri $uri/ /$2/$3;
}


이건 마지막에 넣어주니 되네요!;; 깃헙 소스 그대로 복붙하니 안됐던거 같은데 (__);;


정리하면, 아래 코드만 아래 url 에 넣어주면 됩니다.

플래스크관리자 > 도메인 > 도메인 선택 > Apache & Nginx 설정 > 추가 nginx 지시문

https://oiii.kr:8443/smb/web/web-server-settings/id/2



# 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 minified URLs (for legacy support)
location ~ ^/(.+)\.min\.(css|js)$ {
    try_files $uri $uri/ /$1.$2;
}


# fix download URL when other directives for static files are present
location ~ ^/files/download/ {
    try_files $uri $uri/ /index.php$is_args$args;
}
location ~ / {
    index index.php index.cgi index.pl index.html index.xhtml index.htm index.shtml;
    try_files $uri $uri/ /index.php?$args;
}
# fix incorrect relative URLs (for legacy support)
location ~ ^/(.+)/(addons|files|layouts|m\.layouts|modules|widgets|widgetstyles)/(.+) {
    try_files $uri $uri/ /$2/$3;
}


※관련글

https://xetown.com/questions/1511745

(위 글의 댓글에서 '하나코'님의 코멘트를 확인해주세요!)

NGINX 환경설정

https://opentutorials.org/module/384/4526

NGINX에 GZIP으로 컨텐츠 압축 설정하기

https://www.lesstif.com/system-admin/nginx-gzip-59343019.html

https://docs.plesk.com/en-US/obsidian/extensions-guide/plesk-features-available-for-extensions/integrate-with-system-services/web-server.77213/

https://docs.plesk.com/en-US/obsidian/administrator-guide/web-servers/apache-and-nginx-web-servers-linux/apache-and-nginx-configuration-files.68678/

https://docs.plesk.com/en-US/obsidian/administrator-guide/web-servers/apache-and-nginx-web-servers-linux/apache-with-nginx.70837/

https://docs.plesk.com/en-US/obsidian/customer-guide/websites-and-domains/hosting-settings/web-server-settings/apache-and-nginx-settings.72320/

https://docs.plesk.com/en-US/obsidian/advanced-administration-guide-linux/virtual-hosts-configuration/virtual-hosts-and-hosting-types/virtual-host-configuration-files.72064/


https://opentutorials.org/module/384/4529

https://juneyr.dev/nginx-basics