가상 서버에 nginx 설치해서 어찌어찌 사용하고 있었는데 xe용 rewrite 적용하려해도 도통 되질 않네요.

XE는 관리자 설정 고급에서 짧은 주소 사용하기 선택하였고요.(지금은 일단 미적용으로 했습니다.)

 

설정은 아래의 설명을 참고했습니다.

 

https://github.com/xpressengine/xe-core/wiki/Nginx-rewite-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0

 

 

제 서버는 centos 7이고요. nginx는 아래의 폴더로 되어있습니다.

 

/etc/nginx/nginx.conf

/etc/nginx/xe_rewrite.conf <- 위 주소의 내용을 만듬

/etc/nginx/conf.d/romanesque.me.conf

server {
    listen       80;
    server_name  *.romanesque.me;
    client_max_body_size 1000m;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {

        root   /usr/share/nginx/html/www;
        index  index.php index.html index.htm;
    }

    #error_page  404              /404.html;
    # redirect server error pages to the static page /50x.html
    #

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {
        root   /usr/share/nginx/html/www;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #

    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #

    location ~ \.php$ {
        root           /usr/share/nginx/html/www;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}

    include xe_rewrite.conf;
}

 

참고로 include /etc/nginx/xe_rewrite.conf로 하거나 location 사이사이에 넣어보거나 location / {} 안에 넣어보거나 해도 도통 아래의 메시지만 뿝습니다.

404 Not Found


nginx/1.8.0
 
 
도와주세요 ㅠㅠ

 

  • profile
    include /etc/nginx/xe_rewrite.conf 이렇게 해도 안되면 xe_rewrite.conf파일을 문법이 잘못된겁니다.

    혹시 nginx 재시작해보셨는지요?
  • profile profile
    # reserve XE Layout Template Source File (*.html)
    rewrite ^/(layouts|m.layouts)/(.+)/(.+).html$ /index.php last;
    
    # conf, query, schema
    rewrite ^/(modules|addons|widgets)/(.+)/(conf|queries|schemas)/(.+).xml$ /index.php last;
    
    # static files
    rewrite ^/(.+)/files/(member_extra_info|attach|cache|faceOff)/(.*) /files/$2/$3 last;
    rewrite ^/(.+)/(files|modules|widgets|widgetstyles|layouts|m.layouts|addons)/(.*) /$2/$3 last;
    
    # 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;
    rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/(rss|atom|api)$ /index.php?vid=$1&mid=$2&act=$3 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?vid=$1&document_srl=$2&key=$3&act=trackback last;
    
    # administrator page
    rewrite ^/admin/?$ /index.php?module=admin last;
    
    # document permanent link
    rewrite ^/([0-9]+)$ /index.php?document_srl=$1 last;
    
    # mid link
    rewrite ^/([a-zA-Z0-9_]+)/?$ /index.php?mid=$1 last;
    
    # mid + document link
    rewrite ^/([a-zA-Z0-9_]+)/([0-9]+)$ /index.php?mid=$1&document_srl=$2 last;
    
    # vid + mid link
    rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/?$ /index.php?vid=$1&mid=$2 last;
    
    # vid + mid + document link
    rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)$ /index.php?vid=$1&mid=$2&document_srl=$3 last;
    
    # mid + entry title
    rewrite ^/([a-zA-Z0-9_]+)/entry/(.+)$ /index.php?mid=$1&entry=$2 last;
    
    # vid + mid + entry title
    rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/entry/(.+)$ /index.php?vid=$1&mid=$2&entry=$3 last;
    

     

    이거 잘못된 코드 인가요? xe 공식인데...

     

    그리고 물론 설정 후에 systemctl restart nginx로 재시작 했습니다.

     

    그리고 rewrite라는게 도메인 루트폴더 내에 하위폴더가 없어도 무시하고 메인을 표시하는게 아니었던가요.

     

    http://romanesque.me/board <- 이렇게 하면 그냥 romanesque.me가 표시되어야 하는게 아닌지. 아예 rewrite가 안되는거 같아서 말이죠 ㅠㅠ

  • profile profile
    http://www.conory.com/use_forum/52430 이걸로 해보세요.
  • profile profile
    안되요 ㅠㅠ 똑같이 했는데..

    설치에 문제가 있는건가... 쩝. 나중에 기진곰 님께 의뢰드릴때 이것도 봐달라고 해야곘네요 ㅠㅠ
  • profile
    제가 한 방법으로 안내해드릴게요
  • profile
    server {
            server_name ani.news;
            listen 80;
            root /home/aninews/www;
            access_log /var/log/nginx/ani.news-access.log;
            error_log /var/log/nginx/ani.news-error.log;
            index index.php index.html index.htm;
    
            location / {
                    try_files  $uri $uri/ /index.php?$args;
            }
    
            include lib/xe;
    }

     

     

    # reserve XE Layout Template Source File (*.html)
    rewrite ^/(layouts|m.layouts)/(.+)/(.+).html$ /index.php last;
    
    # conf, query, schema
    rewrite ^/(modules|addons|widgets)/(.+)/(conf|queries|schemas)/(.+).xml$ /index.php last;
    
    # static files
    rewrite ^/(.+)/files/(member_extra_info|attach|cache|faceOff)/(.*) /files/$2/$3 last;
    rewrite ^/(.+)/(files|modules|widgets|widgetstyles|layouts|m.layouts|addons)/(.*) /$2/$3 last;
    
    # 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;
    rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/(rss|atom|api)$ /index.php?vid=$1&mid=$2&act=$3 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?vid=$1&document_srl=$2&key=$3&act=trackback last;
    
    # administrator page
    rewrite ^/admin/?$ /index.php?module=admin last;
    
    # document permanent link
    rewrite ^/([0-9]+)$ /index.php?document_srl=$1 last;
    
    # mid link
    rewrite ^/([a-zA-Z0-9_]+)/?$ /index.php?mid=$1 last;
    
    # mid + document link
    rewrite ^/([a-zA-Z0-9_]+)/([0-9]+)$ /index.php?mid=$1&document_srl=$2 last;
    
    # vid + mid link
    rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/?$ /index.php?vid=$1&mid=$2 last;
    
    # vid + mid + document link
    rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)$ /index.php?vid=$1&mid=$2&document_srl=$3 last;
    
    # mid + entry title
    rewrite ^/([a-zA-Z0-9_]+)/entry/(.+)$ /index.php?mid=$1&entry=$2 last;
    
    # vid + mid + entry title
    rewrite ^/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/entry/(.+)$ /index.php?vid=$1&mid=$2&entry=$3 last;

     

  • profile
    확실하진 않지만 xe 파일에 .conf 확장자를 사용하지 말아보세요.
  • profile

    @CONORY @Anizen

    덕택에 무사히 적용되었습니다. 한 밤 중에 정말 고맙습니다!

     

    원인은 conf.d안에는 실제 이런 파일들이 있어가지고 제가 설정한 파일 이전에 다른 파일이 로드 된게 이유였네요(삽질 했습니다. ㅠ)

     

    /etc/nginx/conf.d/default.bak

    /etc/nginx/conf.d/example_ssl.conf

    /etc/nginx/conf.d/romanesque.co.conf <-아마도 요게 수행된게 아닐까..

    /etc/nginx/conf.d/romanesque.kr.conf

    /etc/nginx/conf.d/romanesque.me.conf <-요걸  수정

     

     

  • profile profile
    해결됐다니 다행이네요!