Update: Multisite / Network Wordpress Config
This commit is contained in:
parent
84006b61fc
commit
c79fbabf1c
14
.env.sample
Normal file
14
.env.sample
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
##
|
||||||
|
## CHANGE VARIABLES ##
|
||||||
|
##
|
||||||
|
|
||||||
|
MYSQL_DATABASE=user
|
||||||
|
MYSQL_USER=user
|
||||||
|
MYSQL_PASSWORD=user
|
||||||
|
MYSQL_HOST=db
|
||||||
|
SSH_USER=user
|
||||||
|
SSH_PASSWORD=user
|
||||||
|
SSH_PORT=2222
|
||||||
|
NGINX_PORT_HTTP=8080
|
||||||
|
NGINX_PORT_HTTPS=8443
|
||||||
|
USER_GROUP=1000:1000
|
114
config/nginx-wordpress-multisite.conf
Normal file
114
config/nginx-wordpress-multisite.conf
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
map $uri $blogname{
|
||||||
|
~^(?P<blogpath>/[^/]+/)wp-content/uploads/sites/(.*) $blogpath ;
|
||||||
|
}
|
||||||
|
|
||||||
|
map $blogname $blogid{
|
||||||
|
default -999;
|
||||||
|
|
||||||
|
#Ref: http://wordpress.org/extend/plugins/nginx-helper/
|
||||||
|
#include /var/www/wordpress/wp-content/plugins/nginx-helper/map.conf ;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 4443 ssl default_server;
|
||||||
|
include snippets/snakeoil.conf;
|
||||||
|
|
||||||
|
server_name lafundicio.net;
|
||||||
|
server_name www.lafundicio.net;
|
||||||
|
|
||||||
|
root /app/wordpress;
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
client_max_body_size 25M;
|
||||||
|
|
||||||
|
location ~ /\. {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* /(?:uploads|files)/.*\.php$ {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^(/[^/]+/)?wp-content/uploads/sites/(.+) {
|
||||||
|
try_files /wp-content/uploads/sites/$blogid/$2 /wp-includes/ms-files.php?file=$2 ;
|
||||||
|
access_log off;
|
||||||
|
log_not_found off; expires max;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 =404;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_read_timeout 300;
|
||||||
|
fastcgi_send_timeout 300;
|
||||||
|
fastcgi_pass wordpress:9000;
|
||||||
|
}
|
||||||
|
|
||||||
|
access_log /app/wordpress.access.log;
|
||||||
|
error_log /app/wordpress.error.log;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
|
||||||
|
listen 8081;
|
||||||
|
|
||||||
|
server_name lafundicio.net;
|
||||||
|
server_name www.lafundicio.net;
|
||||||
|
|
||||||
|
root /app/wordpress;
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
client_max_body_size 25M;
|
||||||
|
|
||||||
|
location ~ /\. {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* /(?:uploads|files)/.*\.php$ {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^(/[^/]+/)?wp-content/uploads/sites/(.+) {
|
||||||
|
try_files /wp-content/uploads/sites/$blogid/$2 /wp-includes/ms-files.php?file=$2 ;
|
||||||
|
access_log off;
|
||||||
|
log_not_found off; expires max;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 =404;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_read_timeout 300;
|
||||||
|
fastcgi_send_timeout 300;
|
||||||
|
fastcgi_pass wordpress:9000;
|
||||||
|
}
|
||||||
|
|
||||||
|
access_log /app/wordpress.access.log;
|
||||||
|
error_log /app/wordpress.error.log;
|
||||||
|
|
||||||
|
}
|
54
config/nginx-wordpress-site.conf
Normal file
54
config/nginx-wordpress-site.conf
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
map $uri $blogname{
|
||||||
|
~^(?P<blogpath>/[^/]+/)files/(.*) $blogpath ;
|
||||||
|
}
|
||||||
|
|
||||||
|
map $blogname $blogid{
|
||||||
|
default -999;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 4443 ssl default_server;
|
||||||
|
|
||||||
|
include snippets/snakeoil.conf;
|
||||||
|
|
||||||
|
root /app/wordpress/;
|
||||||
|
|
||||||
|
index index.php index.html;
|
||||||
|
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$args ;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
try_files $uri /index.php =404;
|
||||||
|
fastcgi_pass wordpress:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
|
||||||
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
|
set $path_info $fastcgi_path_info;
|
||||||
|
fastcgi_param PATH_INFO $path_info;
|
||||||
|
fastcgi_param REMOTE_ADDR $http_x_real_ip;
|
||||||
|
fastcgi_read_timeout 300;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/files/(.*)$ {
|
||||||
|
try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;
|
||||||
|
access_log off; log_not_found off; expires max;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
location ^~ /blogs.dir {
|
||||||
|
internal;
|
||||||
|
alias /var/www/example.com/htdocs/wp-content/blogs.dir;
|
||||||
|
access_log off; log_not_found off; expires max;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user