2013-01-22 2 views
3

미디어 위키가 설치되어 있습니다. 내가 외부 디렉토리 (webalizer 웹 통계)의 별명을 지정하려고 할 때를 제외하고 모두가 전 세계에 있습니다. 나는 Nginx가 /usage/*에 대한 요청을 PHP/Mediawiki로 전달한다는 것을 알고있다. 나는 그것을 원하지 않는다. 나는 문자 그대로/usage/아래의 모든 것을 내 별칭과 다른 것을 가리 키기를 원한다. Mediawiki 코드 및 기능과 완전히 분리됩니다. ,Nginx conf의 단락 논리 (위치를 무시하고 싶습니다)

답변

3

location 지시를 처리에서의 Nginx를 중지하려면)

# in no way related to Mediawiki. I just want to serve this as static HTML. 
location /usage { 
    alias /var/www/webalizer/wiki.longnow.org/; 
} 

# This answers to anything, which may be my problem 
location/{ 
    try_files $uri $uri/ @rewrite; 
    index index.php; 
} 

# A special rewrite to play nicely with Mediawiki 
location @rewrite { 
    rewrite ^/(.*)$ /index.php?title=$1&$args; 
} 

# PHP, nom nom nom 
location ~ \.php$ { 
    include fastcgi_params; 
    fastcgi_index index.php; 
    fastcgi_pass unix:/tmp/php-fastcgi.socket; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
} 

나는 나머지 앞서/사용 위치 지시자를 나열하는 것은 단락 시스템,하지만 난 장고 버릇 된 것이라고 기대했다 접두사가 ^~이어야합니다.
location 안에는 여전히 try_files이 404 응답으로 떨어지고 싶습니다.

location ^~ /usage { 
    alias /var/www/webalizer/wiki.longnow.org/; 
    try_files $uri $uri/ =404;  
} 

참조 용으로 http://wiki.nginx.org/HttpCoreModule#location을 참조하십시오.

관련 문제