![동일한 도메인에서 fastcgi를 사용하는 Nginx 및 여러 WordPress 인스턴스](https://rvso.com/image/515679/%EB%8F%99%EC%9D%BC%ED%95%9C%20%EB%8F%84%EB%A9%94%EC%9D%B8%EC%97%90%EC%84%9C%20fastcgi%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94%20Nginx%20%EB%B0%8F%20%EC%97%AC%EB%9F%AC%20WordPress%20%EC%9D%B8%EC%8A%A4%ED%84%B4%EC%8A%A4.png)
내 사이트가 아파치에서 실행되고 있습니다. /tr/ 및 /eng/ 경로 아래에 두 개의 wordpress 인스턴스가 있습니다. 설정을 nginx로 옮기고 싶지만 작동하게 할 수 없습니다.
내 설정은 nging 0.7.66, php 5.3.2 및 php-fpm으로 구성됩니다. /tr/ 및 /eng/는 각각 /home/istci/webapps/wordpress_tr 및 /home/istci/webapps/wordpress 아래에 위치한 두 개의 별도 wordpress 인스턴스입니다.
다음은 tr에 대한 구성만 포함하는 nginx.conf의 서버 섹션이지만 작동할 수 없습니다.
server {
listen 80;
server_name www.example.com;
charset utf-8;
location ~ ^/$ {
rewrite ^(.+)$ http://www.example.com/tr/ permanent;
}
location ~ /tr/.*php$ {
fastcgi_pass unix:/home/istci/var/run/wptr.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/istci/webapps/wordpress_tr$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
}
location /tr/ {
root /home/istci/webapps/wordpress_tr/;
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^(.+)$ /tr/index.php?q=$1 last;
break;
}
if (-f $request_filename) {
expires 30d;
break;
}
}
}
php-fpm은 unix:/home/istci/var/run/wptr.sock를 수신합니다. 디버그 모드에서 실행하면 활성 핸들러가 표시되지 않습니다. 이는 nginx에서 unix 소켓에 연결되지 않음을 의미합니다.
nginx 액세스 로그:
127.0.0.1 - - [09/Jun/2010:03:45:11 -0500] "GET /tr/ HTTP/1.0" 404 20 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.4) Gecko/20100527 Firefox/3.6.4"
nginx 디버그 로그:
2010/06/09 03:38:53 [notice] 6922#0: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
2010/06/09 03:38:53 [notice] 6922#0: OS: Linux 2.6.18-164.9.1.el5PAE
2010/06/09 03:38:53 [notice] 6922#0: getrlimit(RLIMIT_NOFILE): 4096:4096
2010/06/09 03:38:53 [notice] 6923#0: start worker processes
2010/06/09 03:38:53 [notice] 6923#0: start worker process 6924
2010/06/09 03:38:53 [notice] 6923#0: start worker process 6925
2010/06/09 03:39:01 [notice] 6925#0: *1 "^(.+)$" matches "/tr/", client: 127.0.0.1, server: www.example.com, request: "GET /tr/ HTTP/1.0", host: "www.example.com"
2010/06/09 03:39:01 [notice] 6925#0: *1 rewritten data: "/tr/index.php", args: "q=/tr/", client: 127.0.0.1, server: www.example.com, request: "GET /tr/ HTTP/1.0", host: "www.example.com"
내 구성에 어떤 문제가 있는지에 대한 단서가 있습니까? 감사해요.
답변1
~에 대해 읽다try_files
location /tr {
try_files $uri $uri/ /tr/index.php;
}
location /eng {
try_files $uri $uri/ /eng/index.php;
}
이거 추가 해봐.