我正在尝试使用Nginx,php5-fpm,APC和Batcache来设置Wordpress多站点,使用子目录。 和许多其他人一样,我陷入了固定链接的重写规则中。
我已经按照这两个指南,这似乎是正式的,你可以得到: http : //evansolomon.me/notes/faster-wordpress-multisite-nginx-batcache/ http://codex.wordpress.org/Nginx# WordPress_Multisite_Subdirectory_rules
这是部分工作:
但其他永久链接,如这两个到一个职位或静态页面,不起作用:
他们要么带你到404错误,要么到其他的博客!
这是我的configuration:
server { listen 80 default_server; server_name blog.ssis.edu.vn; root /var/www; access_log /var/log/nginx/blog-access.log; error_log /var/log/nginx/blog-error.log; location / { index index.php; try_files $uri $uri/ /index.php?$args; } # Add trailing slash to */wp-admin requests. rewrite /wp-admin$ $scheme://$host$uri/ permanent; # Add trailing slash to */username requests rewrite ^/[_0-9a-zA-Z-]+$ $scheme://$host$uri/ permanent; # Directives to send expires headers and turn off 404 error logging. location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires 24h; log_not_found off; } # this prevents hidden files (beginning with a period) from being served location ~ /\. { access_log off; log_not_found off; deny all; } # Pass uploaded files to wp-includes/ms-files.php. rewrite /files/$ /index.php last; if ($uri !~ wp-content/plugins) { 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-]+.*(/wp-admin/.*\.php)$ $1 last; rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last; } location ~ \.php$ { # Forbid PHP on upload dirs if ($uri ~ "uploads") { return 403; } client_max_body_size 25M; try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } }
任何想法都欢迎! 我做错了什么? 我已经禁用Batcache,看看它是否有任何区别,但仍然没有去。
哇,你手上真的很乱。
整体而言,nginxconfiguration看起来不错。 try_files语句是唯一让我一读的可能是“错误的”。 在我的生产WordPress多站点,我有:
try_files $uri $uri/ index.php;
没有必要附加参数,因为WordPress在REQUEST_URI可用时(几乎总是)将其从REQUEST_URI提取出来,而当查询string中不存在PATH_INFO时,它们将被PATH_INFO 。
是的,我知道您正在使用的声明是WordPress网站上的“推荐”。 当然,这也是任何人都可以编辑的维基,所以它必须像维基百科一样用盐。
发现问题。 这不是重写规则,尽pipe迈克尔·汉普顿(Michael Hampton)确实让我朝着正确的方向前进。
出于某种原因,wp-config.php文件有两个非常重要的多行configuration注释行:PATH_CURRENT_SITE和BLOG_ID_CURRENT_SITE。
一旦我解决了这个问题,一切都开始完美,我们的网站现在正在快速发展。 我想真正的问题是:这个工作怎么样?
就在这里。 感谢收看!