나는/var/www/apps/example/current/public에 루트가있는 nailsx로 구성된 레일즈 응용 프로그램을 가지고 있습니다. https://www.example.com에서 액세스 할 수 있습니다. 그것들은 모두 위대한 작품. 나는 블로그를 추가하기로 결정했고, 나는 Wordpress와 함께 가고 싶었다.디렉토리에 Wordpress에 대한 Nginx 설정
server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/certs/example.com.pem;
ssl_certificate_key /etc/ssl/certs/example.com.key;
server_name www.example.com;
root /var/www/apps/example/current/public;
passenger_enabled on;
rails_env production;
client_max_body_size 100M;
client_body_buffer_size 256k;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location /blog {
root /var/www/apps;
location ~ [^/]\.php(/|$) {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
: 내의 nginx의 설정 I는 서버의/var/www가/응용 프로그램/블로그의 다른 디렉토리에 설치, 나는 다음
https://www.example.com/blog로 이동하여 액세스 할 수 있도록하려는 것입니다 example.com/blog를 탐색 할 수 있으며 문제없이 저를 데려갑니다. 문제는 예쁜 URL을 사용하고 게시물을 보려고 할 때입니다. 그것은/블로그 디렉토리를 우회 내가 /var/log/nginx/error.log에서 다음과 같은 오류 참조하십시오 (404)으로 끝나는, 내 레일 응용 프로그램을 명중 :
2016/06/30 17:24:32 [error] 7035#0: *20 "/var/www/apps/blog/hello-world/index.html" is not found (2: No such file or directory), client: 199.27.128.198, server: www.example.com, request: "GET /blog/hello-world/ HTTP/1.1", host: "www.example.com", referrer: "https://www.example.com/blog/"
가 index index.php
지시문을 추가하면 수정하지 않습니다 이 문제는 단지 /var/www/apps/blog/hello-world/index.php
이 대신 발견되지 않는다고 말합니다.
아이디어가 있으십니까? 나는 혼란 스럽다.
그것이 올바른 방향으로 나를 지적한 이후의 해결책. 단순히'try_files $ uri $ uri//blog/index.php? $ args; '를 추가하면 트릭을 작성한 첫 번째 예가됩니다. – Orlando