2017-12-16 8 views
0

두 개의 레일 앱과 동일한 도메인에서 실행중인 WordPress가 있습니다. 레일 애플 리케이션을 잘 실행,하지만 나는 워드 프레스 하위 디렉토리에서 일할 수 없습니다. 그것은 루트에서 봉사에서 작동합니다.nginx 및 wordpress 하위 디렉토리에서 액세스가 거부되었습니다.

nginx error.log에서 다음 오류가 발생합니다. 경로의 더블 워드 프레스에주의하십시오, 그게 문제지만, 어떻게 해결 해야할지 모르겠습니다! 진정한 길은/var/www/wordpress/wordpress가 아니라/var/www/wordpress/wordpress입니다!

2017/12/16 21:15:18 [error] 17341#17341: *7 FastCGI sent in stderr: "Access 
to the script '/var/www/wordpress/wordpress' has been denied (see 
security.limit_extensions)" while reading response header from upstream, 
client: ... 

가 여기 내의 nginx의 설정입니다 : 문제는 여기에있다

server { 
    server_name www.example.com; 
    listen 443 ssl; 
    root /var/www/first_rails_app/public; 
    passenger_enabled on; 
    passenger_app_root /var/www/first_rails_app/; 
    passenger_document_root /var/www/first_rails_app/public; 
    rails_env production; 

    index index.htm index.html; 

    error_page 404 /404.html; 
    error_page 500 502 503 504 /50x.html; 

    location /wordpress { 
     try_files $uri $uri/ /wordpress/index.php?$args; 
     root /var/www/wordpress; 
     index index.php; 
     passenger_enabled off; 

     location ~ .php(?|$) { 
      try_files $uri =404; 
      fastcgi_split_path_info ^(/wordpress)(/.*)$; 
      fastcgi_pass unix:/run/php/php5.6-fpm.sock; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
      include fastcgi_params; 
      #passenger_enabled off; 
     }       
    } 

    location ~ ^/second_rails_app(/.*|$) { 
     alias /var/www/second_rails_app/public$1; # <-- be sure to point to 'public'! 
     passenger_base_uri /second_rails_app; 
     passenger_app_root /var/www/second_rails_app/; 
     passenger_document_root /var/www/second_rails_app/public; 
     passenger_enabled on; 
    } 

    ssl_session_timeout 5m; 

    ssl_protocols TLSv1.1 TLSv1.2; 
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; 
    ssl_prefer_server_ciphers on; 

    client_max_body_size 4G; 
    keepalive_timeout 10; 

} 
+0

작동합니다. '.php' 파일 만 허용하도록 설정되었을 것입니다 –

답변

0

try_files $uri $uri/ /wordpress/index.php?$args; 
    root /var/www/wordpress; 

귀하의 try_files 라인이 요청 된 파일을 찾으라고,이 디렉토리의 경우는 체크를 찾을 수없는 경우, 작동하지 않는 경우 루트 디렉토리 + /wordpress/index.php?$args, 즉 /var/www/wordpress/wordpress/index.php?$args

워드 프레스에 대한

이 당신은 PHP-FPM 구성에서`security.limit_extensions` 옵션을 편집 할 필요가

try_files $uri $uri/ /index.php;