반응형
Symfony와 WordPress가 함께 실행되는 nginx 구성
저는 /var/www/my site/symfony 사이트와 /var/www/my site/wordpress 블로그를 가지고 있습니다.mysite.com/blog 을 워드프레스와 기타 모든 요청을 Symfony로 전송하려면 어떻게 해야 합니까?제가 지금까지 시도한 것은 다음과 같습니다.
server {
server_name mysite.com;
root /var/www/mysite/symfony/web;
location / {
try_files $uri /app.php$is_args$args;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
}
location ~ ^/blog {
root /var/www/mysite/wordpress;
try_files $uri $uri/ /blog/index.php?$args;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
}
}
access_log /var/log/nginx/mysite-access.log;
error_log /var/log/nginx/mysite-error.log;
}
이 구성을 사용하면 mysite.com/blog 을 방문할 때 '파일을 찾을 수 없습니다.' 오류가 발생합니다.내 nginx 로그 파일에 다음이 표시됩니다.FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream
. Symfony가 내 사이트 루트에서 잘 실행되므로 내 php-fpm 설정에 문제가 되지 않는다는 것을 알고 있습니다.
어디가 잘못됐나요?
하위 폴더에서 워드프레스를 설치하기 위한 특정 규칙을 찾았습니다.
# Replace all occurrences of [subfolder] with the folder where your WordPress install is located
# The WordPress rewrite
location /[subfolder] {
try_files $uri $uri/ /[subfolder]/index.php?$args;
}
# The default MODX rewrite</h1>
location / {
try_files $uri $uri/ @modx-rewrite;
}
원본 게시물: 웹 규칙: Nginx 다시 쓰기, 리디렉션 및 기타 클라우드 구성 | MODX 클라우드
언급URL : https://stackoverflow.com/questions/26769292/nginx-configuration-for-symfony-and-wordpress-running-alongside-each-other
반응형
'programing' 카테고리의 다른 글
Linear Layout으로 화면 하단에 버튼을 넣으시겠습니까? (0) | 2023.10.31 |
---|---|
MariaDB 데이터베이스 표시 권한 (0) | 2023.10.31 |
웹 브라우저에서 GPS 위치 가져오기 (0) | 2023.10.31 |
Twitter 부트스트랩의 둥근 모서리를 모두 제거하기 (0) | 2023.10.31 |
Eclipse에서 Python Extension 디버깅 (0) | 2023.10.31 |