apache の前で静的ファイルを提供するために、nginx をリバース プロキシとして設定しようとしています。WP Super Cache を使用して、Wordpress マルチサイト用に nginx を構成するのに問題があります。次の構成がありますが、機能しません。
server {
listen 80;
# Main site domain
server_name main.com *.main.com;
# Mapped domains
server_name mapped.com www.mapped.com;
root /home/me/www/wordpress/htdocs;
access_log /home/me/www/wordpress/logs/access.log;
error_log /home/me/www/wordpress/logs/error.log;
index index.php index.html index.htm;
error_page 404 = @wordpress;
log_not_found off;
location / {
try_files $uri $uri/ /index.php?$args;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
}
############## WP MULTISITE ##############
rewrite ^/files/(.+) /wp-includes/ms-files.php?file=$1 last;
location ^~ /files/ {
rewrite ^.*/files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
}
# Rewrite multisite '.../wp-.*' and '.../*.php'.
if (!-e $request_filename) {
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}
############## WP MULTISITE ##############
############## WP SUPER CACHE ############
if (-f $request_filename) {
#expires max;
break;
}
if (-d $request_filename) {
break;
}
set $supercache_file '';
set $supercache_uri $request_uri;
if ($request_method = POST) {
set $supercache_uri '';
}
if ($query_string) {
set $supercache_uri '';
}
if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
set $supercache_uri '';
}
if ($supercache_uri ~ ^(.+)$) {
set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html;
}
if (-f $document_root$supercache_file) {
rewrite ^(.*)$ $supercache_file break;
}
############## WP SUPER CACHE ############
location @wordpress {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080;
}
location ~ \.php$ {
try_files $uri @wordpress;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080;
}
}
ページのロード時に次のエラーが発生します。
main.com : 310 - ERR_TOO_MANY_REDIRECTS
main.com/wp-admin/ : Loads WP admin page
www.main.com : Welcome to nginx!
mapped.com / www.mapped.com: 403 - Forbidden - "You don't have permission to access /index.php on this server."
どんな助けでも大歓迎です!