Nginx configuration rules enable the multi-site feature for WordPress
When you enable the WordPress multi-site mode, you will be prompted to write a rewrite file to the. htaccess file, as shown below:
1234567891011
RewriteEngine OnRewriteBase/RewriteRule ^ index \. php $-[L] # uploaded filesRewriteRule ^ files/(. +) wp-uplodes/ms-files.php? File = $1 [L] RewriteCond % {REQUEST_FILENAME}-f [OR] RewriteCond % {REQUEST_FILENAME}-dRewriteRule ^-[L] RewriteRule. index. php [L]
However, the above rules are applied to Apache and won't work in Nginx. You need to adjust the rules as follows:
Find/usr/local/nginx/conf on the Server and use vi to edit the Server module in nginx. conf. Add the following content:
123456789101112
# On server block # necessary if using a multi-site pluginserver_name_in_redirect off; # necessary if running Nginx behind a reverse-proxyport_in_redirect off; rewrite ^. */files /(. *) $/wp-DES/ms-files.php? File = $1 last; if (! -E $ request_filename) {rewrite ^. +? (/Wp-. *) $1 last; rewrite ^. +? (/. * \. Php) $1 last; rewrite ^/index. php last ;}
After modification, access/usr/local/nginx/sbin and execute./nginx-s reload.