我正在子目录中的本地主机上设置多站点。
问题是,当我尝试访问我刚刚创建的站点的仪表板( localhost/wptest/site/wp-admin )时,我得到了“此网页有重定向循环”当我尝试访问实际网站(localhost / wptest / site)时,页面加载但没有资产,例如css。
当我访问网络仪表板或 localhost/wptest 上的主站点仪表板时,一切都很好。此外,当我在网络仪表板中编辑第二个站点的永久链接时,如下所示:localhost/site,它也运行良好。
如何使其与默认永久链接结构 localhost/wptest/site 一起工作?
wordpress 文件位于
/usr/share/html/wptest
wp-config.php如下:
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'localhost');
define('PATH_CURRENT_SITE', '/wptest/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
服务器块/虚拟主机如下:
server {
##DM - uncomment following line for domain mapping
listen 80 default_server;
#server_name example.com *.example.com ;
##DM - uncomment following line for domain mapping
#server_name_in_redirect off;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
root /usr/share/nginx/html/wptest;
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
location / {
try_files $uri $uri/ /index.php?$args ;
}
location ~ \.php$ {
try_files $uri /index.php;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
location = /robots.txt { access_log off; log_not_found off; }
location ~ /\. { deny all; access_log off; log_not_found off; }
}
最后,这里有一个错误日志:
2013/06/29 08:05:37 [error] 4056#0: *52 rewrite or internal redirection cycle while internally redirecting to "/index.php", client: 127.0.0.1, server: example.com, request: "GET /nginx HTTP/1.1", host: "localhost"
答案1
尝试这个 -http://rtcamp.com/wordpress-nginx/tutorials/multisite/subdirectories/in-a-subdirectory/
您只需调整几行即可。在上述 URL 的配置中将其替换wordpress
为。wptest
除此之外,你可能需要进行一些小调整。告诉我进展如何!