2012-09-19 2 views
1

웬일인지 Wordpress가 nginx에서 작동하는 데 문제가 있습니다.WordPress의 URL을 nginx에 다시 작성하면 WordPress가 기본 디렉토리에 없습니다.

"site"(public_html 내부) 폴더에 Wordpress 설치 프로그램이 있습니다. 이 내 nginx를 구성입니다 : 나는 내 웹 사이트 http://wouterds.be/를 방문 할 때

server { 
    server_name www.wouterds.be wouterds.be; 
    access_log /srv/www/www.wouterds.be/logs/access.log; 
    error_log /srv/www/www.wouterds.be/logs/error.log; 

    location/{ 
     root /srv/www/www.wouterds.be/public_html; 
     index index.php index.html index.htm; 
     try_files $uri $uri/ /site/index.php?$args; 
     autoindex on; 
    } 

    location ~ \.php$ { 
     include /etc/nginx/fastcgi_params; 
     fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket; 
     fastcgi_index index.php; 
     fastcgi_param SCRIPT_FILENAME /srv/www/www.wouterds.be/public_html$fastcgi_script_name; 
    } 
} 

난 그냥 디렉토리 인덱스를 얻을. http://wouterds.be/blog/을 방문하면 올바른 페이지가 나타나고 모든 것이 효과적입니다. 하지만 기본 URL에서 작동하도록하는 방법을 모릅니다.

조금 도와 줄 수있는 사람은 누구입니까? 나는 확실히 nginx 전문가가 아니다. 그리고 4 시간의 Google - ing 이후 나는 그것을 여기에서 시험해보기로 결정했다.

답변

0

그냥 변화 :

root /srv/www/www.wouterds.be/public_html; 

root /srv/www/www.wouterds.be/public_html/site; 

에 워드 프레스의 index.php를 가정 내부 site 폴더입니다.

root 행을 & 외부의 location 블록으로 이동하십시오. /wordpress/ 또는 어떤 디렉토리가에 대한

rewrite /wp-admin$ $scheme://$host$uri/ last; 
rewrite ^/(wp-.*.php)$ /wp/$1 last; 
rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last; 

교환 /wp/을 : 당신은 또한 (안 위치 블록) 시도 할 수

server { 
    #other stuff 

    root /srv/www/www.wouterds.be/public_html/site ; 

    location/{ 
     root /srv/www/www.wouterds.be/public_html; 
     index index.php index.html index.htm; 
     try_files $uri $uri/ /site/index.php?$args; 
     autoindex on; 
    } 

    #other stuff 
} 
+0

나는 리디렉션 루프를 얻을. – Ryan

관련 문제