2
我試圖在Nginx的三個不同目錄中託管三個獨立的WordPress站點。經過數小時的研究,我完全無法找到允許我訪問網站上的/wp-admin
和各種網頁的配置。Nginx - 不同子目錄中的多個WordPress網站 -/wp-admin重定向循環
這裏是我的時刻:
server {
listen 80;
listen [::]:80 ipv6only=on;
root /var/www;
server_name my.ip.add.ress;
location /wp1 {
root /var/www/wp1;
index index.php index.html index.htm;
try_files $uri $uri/ /wp1/index.php?q=$args;
}
location /wp2 {
root /var/www/wp2;
index index.php index.html index.htm;
try_files $uri $uri/ /wp2/index.php?q=$args;
}
location /wp3 {
root /var/www/wp3;
index index.php index.html index.htm;
try_files $uri $uri/ /wp3/index.php?q=$args;
}
if (!-e $request_filename) {
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ $1 last;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_cache moodle;
fastcgi_cache_valid 200 60m;
fastcgi_read_timeout 3600;
}
# Cache static content
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
}
當我試圖訪問/可溼性粉劑管理員,我的瀏覽器被卡在重定向循環。使用rewrite_log不會輸出。