Multisite and NGinx
-
I try to create a network in already existing WP installation for site https://www.lospaziobianco.it
I’m on a VPS with NGINX, so no htaccess.
I find very confused instruction for NGINX configuration, and all with instructions for a new .conf file, so it’s hard to understand wich of this instructions are to copy and wich are still in my conf.
So, i try, i create a new site
https://www.lospaziobianco.it/sonofumettiif i visit this page, i have a blank page. if i go on
https://www.lospaziobianco.it/sonofumetti/wp-admin/
i have a message of bad redirect.This is my nginx conf. Someone can help me?
server {
listen *:80;
server_name lospaziobianco.it https://www.lospaziobianco.it lospaziobianco.org https://www.lospaziobianco.org;
access_log /var/log/nginx/lospaziobianco.it.access.log combined ;
error_log /var/log/nginx/lospaziobianco.it.error.log;
root /var/www/lospaziobianco.it;
index index.php;rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;### FOR WEBFONT ###################################
location ~ \.(ttf|ttc|otf|eot|woff|font.css|css)$ {
add_header Access-Control-Allow-Origin “*”;
}
###################################################### MULTISITE RULES #################################
location ~ ^/[_0-9a-zA-Z-]+/files/(.*)$ {
try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2 ;
access_log off; log_not_found off; expires max;
}#avoid php readfile()
location ^~ /blogs.dir {
internal;
alias /var/www/lospaziobianco.it/htdocs/wp-content/blogs.dir ;
access_log off; log_not_found off; expires max;
}# Rewrite multisite ‘…/wp-.*’ and ‘…/*.php’.
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}
#####################################################access_log off;
set $cache_uri $request_uri;
# POST requests and urls with a query string should always go to PHP
set $skip_cache 0;
if ($request_method = POST) {
set $cache_uri ‘null cache’;
set $skip_cache 1;
}
if ($query_string != “”) {
set $cache_uri ‘null cache’;
set $skip_cache 1;
}# Don’t cache uris containing the following segments
if ($request_uri ~* “(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)”) {
set $cache_uri ‘null cache’;
set $skip_cache 1;
}# Don’t use the cache for logged in users or recent commenters
if ($http_cookie ~* “comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in”) {
set $cache_uri ‘null cache’;
set $skip_cache 1;
}location / {
try_files /wp-content/cache/wp-rocket/$http_host/$cache_uri/index.html $uri/ /index.php?$args;
}location ~ /purge(/.*) {
fastcgi_cache_purge caching “$scheme$request_method$host$1”;
}# Global restrictions configuration file.
# Designed to be included in any server {} block.</p>
location = /favicon.ico {
log_not_found off;
access_log off;
}location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~ /\. {
deny all;
}# Deny access to any files with a .php extension in the uploads directory
# Works in sub-directory installs and also in multisite network
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
#location ~* /(?:uploads|files)/.*\.php$ {
# deny all;
#}# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;# Directives to send expires headers and turn off 404 error logging.
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;
}# Pass all .php files onto a php-fpm/php-fcgi server.
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
# This is a robust solution for path info security issue and works with “cgi.fix_pathinfo = 1” in /etc/php.ini (default)fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_index index.php;
# fastcgi_intercept_errors on;
fastcgi_pass XXX.X.X.X:XXXX;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache caching;
fastcgi_cache_valid 60m;
fastcgi_connect_timeout 360s;
fastcgi_send_timeout 360s;
fastcgi_read_timeout 600s;
}}
- The topic ‘Multisite and NGinx’ is closed to new replies.