2017-05-14 15 views
1

다른 위치에서 Nextcloud, 홈페이지 및 서류 작업을 실행하려고하지만 nginx-config를 올바르게 구성하는 방법을 알 수 없습니다. > 웹 사이트
| - | -> nextcloud
| -> 서류다음 크라우드/웹 사이트/서류 작업과 함께 Nginx 사용

내 홈페이지에 도달 할 수

의/var/www /에서
가 :

내 작업 나무는 다음과 같습니다 web.domain.com을 통해 내 Nextcloud ist는 cloud.domain.com으로 연결할 수 있습니다. 이제 web.domain.com/notes에서 Paperwork에 도달 할 수있게하려고합니다. 서류의 index.php는 "서류/프론트 엔드/공개"라는 하위 폴더에 있습니다.

이 (전체 SSL 및 클라우드 부분없이)이 문제를 해결하기 위해 내이 시도이다 : 나는 많은 다른 솔루션을 시도

server{ 
    listen 443 ssl http2; 
    server_name web.domain.com; 
    error_log /var/log/nginx/debug.log debug; 

    root /var/www/website; 
    location/{ 
    index index.php index.html; 
    } 

    location /notes { 
      alias /var/www/paperwork/frontend/public; 
      index index.php index.html index.htm; 
      try_files $uri $uri/index.php; 
    } 

    location ~ /(nextcloud|backups) { 
      deny all; 
      return 403; 
    } 
    location ^~ /nextcloud/ { 
      deny all; 
      return 402; 
    } 
    location ^~ /nextcloud/ { 
      deny all; 
      return 402; 
    } 

    location ~ \.php$ { 
      try_files $uri =404; 
      alias /var/www/paperwork/frontend/public; 
      index index.php index.html index.htm; 

      fastcgi_pass unix:/var/run/php5-fpm.sock; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME 
      $document_root$fastcgi_script_name; 
      include fastcgi_params; 

    } 
} 

하지만 그는 잘못된 디렉토리를 사용하고 있기 때문에 내가 eather (404)를 얻을 /var/www/notes/index.php (또는 비슷한 오류)를 찾을 수 없거나 nginx가 index.php를 파일 다운로드로 반환하고 있습니다.

미리 Thx!

답변

0

깨끗한 솔루션을 위해 중첩 된 위치 블록을 사용하십시오. 모호성을 피하기 위해 ^~ 수정자를 주목하십시오. 자세한 내용은 this document을 참조하십시오.

시도 :

location ^~ /notes { 
    alias /var/www/paperwork/frontend/public; 
    index index.php index.html index.htm; 

    if (!-e $request_filename) { rewrite^/notes/index.php last; } 

    location ~ \.php$ { 
     if (!-f $request_filename) { return 404; } 

     fastcgi_pass unix:/var/run/php5-fpm.sock; 

     include fastcgi_params; 
     fastcgi_param SCRIPT_FILENAME $request_filename; 
    } 
} 

try_filesalias의 사용에 관한 long standing bug 있습니다. if의 사용에 대해서는 this caution을 참조하십시오.

fastcgi_param 지시문을 사용하기 전에 fastcgi_params을 포함하십시오. 매개 변수가 자동으로 덮어 쓸 수 있습니다.

+0

방금 ​​시도해 보았습니다. 넌 힘이있어. 렉스! –