simplify locations nginx template
This commit is contained in:
2
install
2
install
@@ -425,7 +425,7 @@ wo_upgrade_nginx() {
|
||||
rm -f /tmp/nginx-wo.key
|
||||
sudo apt-get update
|
||||
|
||||
CHECK_NGINX_UPSTREAM_VERSION=$(grep "v3.9.5" /etc/nginx/conf.d/upstream.conf)
|
||||
CHECK_NGINX_UPSTREAM_VERSION=$(grep "v3.9.5" /etc/nginx/conf.d/fastcgi.conf)
|
||||
if [ -z "$CHECK_NGINX_UPSTREAM_VERSION" ]; then
|
||||
|
||||
# stop nginx
|
||||
|
||||
@@ -271,8 +271,8 @@ class WOStackController(CementBaseController):
|
||||
wo_nginx.close()
|
||||
|
||||
Log.debug(self, 'Writting the nginx configuration to '
|
||||
'file /etc/nginx/common/locations-php72.conf')
|
||||
wo_nginx = open('/etc/nginx/common/locations-php72.conf',
|
||||
'file /etc/nginx/common/locations-wo.conf')
|
||||
wo_nginx = open('/etc/nginx/common/locations-wo.conf',
|
||||
encoding='utf-8', mode='w')
|
||||
self.app.render((data), 'locations.mustache',
|
||||
out=wo_nginx)
|
||||
@@ -321,14 +321,6 @@ class WOStackController(CementBaseController):
|
||||
# php73 conf
|
||||
if not os.path.isfile("/etc/nginx/common/php73.conf"):
|
||||
# data = dict()
|
||||
Log.debug(self, 'Writting the nginx configuration to '
|
||||
'file /etc/nginx/common/locations-php73.conf')
|
||||
wo_nginx = open('/etc/nginx/common/locations-php73.conf',
|
||||
encoding='utf-8', mode='w')
|
||||
self.app.render((data), 'locations-php7.mustache',
|
||||
out=wo_nginx)
|
||||
wo_nginx.close()
|
||||
|
||||
Log.debug(self, 'Writting the nginx configuration to '
|
||||
'file /etc/nginx/common/php73.conf')
|
||||
wo_nginx = open('/etc/nginx/common/php73.conf',
|
||||
@@ -369,6 +361,15 @@ class WOStackController(CementBaseController):
|
||||
out=wo_nginx)
|
||||
wo_nginx.close()
|
||||
|
||||
if not os.path.isfile("/etc/nginx/common/locations-wo.conf"):
|
||||
Log.debug(self, 'Writting the nginx configuration to '
|
||||
'file /etc/nginx/common/locations-wo.conf')
|
||||
wo_nginx = open('/etc/nginx/common/locations-wo.conf',
|
||||
encoding='utf-8', mode='w')
|
||||
self.app.render((data), 'locations.mustache',
|
||||
out=wo_nginx)
|
||||
wo_nginx.close()
|
||||
|
||||
# Nginx-Plus does not have nginx
|
||||
# package structure like this
|
||||
# So creating directories
|
||||
@@ -564,13 +565,6 @@ class WOStackController(CementBaseController):
|
||||
if (os.path.isdir("/etc/nginx/common") and
|
||||
not os.path.isfile("/etc/nginx/common/php73.conf")):
|
||||
data = dict()
|
||||
Log.debug(self, 'Writting the nginx configuration to '
|
||||
'file /etc/nginx/common/locations-php73.conf')
|
||||
wo_nginx = open('/etc/nginx/common/locations-php73.conf',
|
||||
encoding='utf-8', mode='w')
|
||||
self.app.render((data), 'locations-php7.mustache',
|
||||
out=wo_nginx)
|
||||
wo_nginx.close()
|
||||
|
||||
Log.debug(self, 'Writting the nginx configuration to '
|
||||
'file /etc/nginx/common/php73.conf')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# WordOps admin NGINX CONFIGURATION
|
||||
# WordOps admin NGINX CONFIGURATION - WO v3.9.5
|
||||
|
||||
server {
|
||||
|
||||
@@ -21,7 +21,7 @@ server {
|
||||
|
||||
# HTTP Authentication on port 22222
|
||||
include common/acl.conf;
|
||||
|
||||
|
||||
# nginx-vts-status
|
||||
location /vts_status {
|
||||
vhost_traffic_status_display;
|
||||
@@ -47,7 +47,7 @@ server {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass php72;
|
||||
}
|
||||
|
||||
|
||||
location /netdata {
|
||||
return 301 /netdata/;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# FastCGI cache settings
|
||||
# FastCGI cache settings - WO v3.9.5
|
||||
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:50m inactive=60m max_size=256M;
|
||||
fastcgi_cache_key "$scheme$request_method$host$request_uri";
|
||||
fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# NGINX CONFIGURATION FOR COMMON LOCATION
|
||||
# NGINX CONFIGURATION FOR COMMON LOCATION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
# Basic locations files
|
||||
location = /favicon.ico {
|
||||
@@ -52,29 +52,3 @@ location ~* "\.(old|orig|original|php#|php~|php_bak|save|swo|aspx?|tpl|sh|bash|b
|
||||
location ~* "/(=|\$&|_mm|(wp-)?config\.|cgi-|etc/passwd|muieblack)" {
|
||||
deny all;
|
||||
}
|
||||
# Status pages
|
||||
location = /nginx_status {
|
||||
stub_status on;
|
||||
access_log off;
|
||||
include common/acl.conf;
|
||||
}
|
||||
location ~ ^/(status|ping)$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass php73;
|
||||
include common/acl.conf;
|
||||
}
|
||||
# WordOps (wo) utilities
|
||||
# phpMyAdmin settings
|
||||
location = /pma {
|
||||
return 301 https://$host:22222/db/pma;
|
||||
}
|
||||
location = /phpMyAdmin {
|
||||
return 301 https://$host:22222/db/pma;
|
||||
}
|
||||
location = /phpmyadmin {
|
||||
return 301 https://$host:22222/db/pma;
|
||||
}
|
||||
# Adminer settings
|
||||
location = /adminer {
|
||||
return 301 https://$host:22222/db/adminer;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# NGINX CONFIGURATION FOR COMMON LOCATION
|
||||
# NGINX CONFIGURATION FOR COMMON LOCATION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
# Basic locations files
|
||||
location = /favicon.ico {
|
||||
@@ -52,29 +52,3 @@ location ~* "\.(old|orig|original|php#|php~|php_bak|save|swo|aspx?|tpl|sh|bash|b
|
||||
location ~* "/(=|\$&|_mm|(wp-)?config\.|cgi-|etc/passwd|muieblack)" {
|
||||
deny all;
|
||||
}
|
||||
# Status pages
|
||||
location = /nginx_status {
|
||||
stub_status on;
|
||||
access_log off;
|
||||
include common/acl.conf;
|
||||
}
|
||||
location ~ ^/(status|ping)$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass php72;
|
||||
include common/acl.conf;
|
||||
}
|
||||
# WordOps (wo) utilities
|
||||
# phpMyAdmin settings
|
||||
location = /pma {
|
||||
return 301 https://$host:22222/db/pma;
|
||||
}
|
||||
location = /phpMyAdmin {
|
||||
return 301 https://$host:22222/db/pma;
|
||||
}
|
||||
location = /phpmyadmin {
|
||||
return 301 https://$host:22222/db/pma;
|
||||
}
|
||||
# Adminer settings
|
||||
location = /adminer {
|
||||
return 301 https://$host:22222/db/adminer;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# NGINX CONFIGURATION FOR FASTCGI_CACHE EXCEPTION
|
||||
# NGINX CONFIGURATION FOR FASTCGI_CACHE EXCEPTION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
|
||||
# do not cache xhtml request
|
||||
@@ -52,4 +52,3 @@ map $skip_cache $cache_uri {
|
||||
default 'null cache';
|
||||
0 $request_uri;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# PHP NGINX CONFIGURATION
|
||||
# PHP NGINX CONFIGURATION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php$is_args$args;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# PHP NGINX CONFIGURATION
|
||||
# PHP NGINX CONFIGURATION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php$is_args$args;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Redis NGINX CONFIGURATION
|
||||
# Redis NGINX CONFIGURATION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Redis NGINX CONFIGURATION
|
||||
# Redis NGINX CONFIGURATION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# NGINX UPSTREAM CONFIGURATION v3.9.5
|
||||
# NGINX UPSTREAM CONFIGURATION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
#-------------------------------
|
||||
# PHP 5.6
|
||||
|
||||
@@ -25,7 +25,7 @@ server {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
|
||||
# Security settings for better privacy
|
||||
# Deny hidden files
|
||||
location ~ /\.(?!well-known\/) {
|
||||
@@ -52,7 +52,7 @@ server {
|
||||
{{^static}}include {{#basic}}common/php73.conf;{{/basic}}{{#wpfc}}common/wpfc-php73.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php73.conf;{{/wpsc}}{{#wpredis}}common/redis-php73.conf;{{/wpredis}}
|
||||
{{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}}
|
||||
{{#wp}}include common/wpcommon-php73.conf;{{/wp}}
|
||||
include common/locations-php73.conf;{{/proxy}}
|
||||
include common/locations-wo.conf;{{/proxy}}
|
||||
include {{webroot}}/conf/nginx/*.conf;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ server {
|
||||
#server_name_in_redirect off;
|
||||
{{/multisite}}
|
||||
|
||||
access_log /var/log/nginx/{{site_name}}.access.log {{^wpredis}}{{^static}}rt_cache{{/static}}{{/wpredis}}{{#wpredis}}rt_cache_redis{{/wpredis}};
|
||||
access_log /var/log/nginx/{{site_name}}.access.log {{^wpredis}}{{^static}}rt_cache{{/static}}{{/wpredis}}{{#wpredis}}rt_cache_redis{{/wpredis}};
|
||||
error_log /var/log/nginx/{{site_name}}.error.log;
|
||||
|
||||
{{#proxy}}
|
||||
@@ -25,7 +25,7 @@ server {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
|
||||
# Security settings for better privacy
|
||||
# Deny hidden files
|
||||
location ~ /\.(?!well-known\/) {
|
||||
@@ -40,7 +40,7 @@ server {
|
||||
|
||||
{{^proxy}}
|
||||
root {{webroot}}/htdocs;
|
||||
|
||||
|
||||
index {{^static}}index.php{{/static}} index.html index.htm;
|
||||
|
||||
{{#static}}
|
||||
@@ -52,7 +52,7 @@ server {
|
||||
{{^static}}include {{#basic}}common/php72.conf;{{/basic}}{{#wpfc}}common/wpfc-php72.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php72.conf;{{/wpsc}}{{#wpredis}}common/redis-php72.conf;{{/wpredis}}
|
||||
{{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}}
|
||||
{{#wp}}include common/wpcommon-php72.conf;{{/wp}}
|
||||
include common/locations-php72.conf;{{/proxy}}
|
||||
include common/locations-wo.conf;{{/proxy}}
|
||||
include {{webroot}}/conf/nginx/*.conf;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# WEBP NGINX CONFIGURATION
|
||||
# WEBP NGINX CONFIGURATION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
|
||||
map $http_accept $webp_suffix {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# WordPress COMMON SETTINGS
|
||||
# WordPress COMMON SETTINGS - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
# Limit access to avoid brute force attack
|
||||
location = /wp-login.php {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# WordPress COMMON SETTINGS
|
||||
# WordPress COMMON SETTINGS - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
# Limit access to avoid brute force attack
|
||||
location = /wp-login.php {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# WPFC NGINX CONFIGURATION
|
||||
# WPFC NGINX CONFIGURATION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# WPFC NGINX CONFIGURATION
|
||||
# WPFC NGINX CONFIGURATION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# WPSC NGINX CONFIGURATION
|
||||
# WPSC NGINX CONFIGURATION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
# $cache_uri variable set in /etc/nginx/conf.d/map-wp.conf
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# WPSC NGINX CONFIGURATION
|
||||
# WPSC NGINX CONFIGURATION - WO v3.9.5
|
||||
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
||||
# $cache_uri variable set in /etc/nginx/conf.d/map-wp.conf
|
||||
|
||||
|
||||
Reference in New Issue
Block a user