diff --git a/docs/wo.8 b/docs/wo.8 index dc08d30..a6128b8 100644 --- a/docs/wo.8 +++ b/docs/wo.8 @@ -5,15 +5,15 @@ .SH SYNOPSIS wo [ --version | --help | info | stack | site | debug | update | clean | import_slow_log | log | secure | sync] .TP -wo stack [ install | remove | purge | migrate | upgrade] [ --web | --mail | --all | --nginx | --php | --php72 | --mysql | --admin | --postfix | --mailscanner | --adminer | --redis | --hhvm | --phpmyadmin | --phpredisadmin | --wpcli | --utils ] +wo stack [ install | remove | purge | migrate | upgrade] [ --web | --all | --nginx | --php | --php73 | --mysql | --admin | --adminer | --redis | --hhvm | --phpmyadmin | --phpredisadmin | --wpcli | --utils ] .TP -wo stack [ status | start | stop | reload | restart ] [--all | --nginx | --php | --php72 |--mysql | --devcot | --web | --postfix | --memcache | --redis] +wo stack [ status | start | stop | reload | restart ] [--all | --nginx | --php | --php73 |--mysql | --web | --memcache | --redis] .TP wo site [ list | info | show | enable | disable | edit | cd | show ] [ example.com ] .TP -wo site create example.com [ --html | --php | --php72 | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm | --letsencrypt/-le]] +wo site create example.com [ --html | --php | --php73 | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis | --hhvm | --letsencrypt/-le]] .TP -wo site update example.com [ --php | --php72 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm ] [--password] [--letsencrypt=on/off/renew]] +wo site update example.com [ --php | --php73 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis | --hhvm ] [--password] [--letsencrypt=on/off/renew]] .TP wo site delete example.com [--db | --files | --all | --no-prompt | --force/-f ] .TP @@ -46,19 +46,19 @@ Display WordOps (wo) help. .TP .B stack .TP -.B install [ --all | --web | --mail | --nginx | --php | --php72 |--mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] +.B install [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] .br Install Nginx PHP5 MySQL Postfix stack Packages if not used with .br any options.Installs specific package if used with option. .TP -.B remove [ --all | --web | --mail | --nginx | --php | --php72 |--mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] +.B remove [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] .br Remove Nginx PHP5 MySQL Postfix stack Packages if not used with .br any options. Remove specific package if used with option. .TP -.B purge [ --all | --web | --mail | --nginx | --php | --php72 |--mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] +.B purge [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] .br Purge Nginx PHP5 MySQL Postfix stack Packages if not used with any .br @@ -66,23 +66,23 @@ options.Purge specific package if used with option. .TP .B status .br -Display status of NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server services. +Display status of NGINX, PHP7.2-FPM, MySQL, Redis-Server services. .TP .B start .br -Start services NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server. +Start services NGINX, PHP7.2-FPM, MySQL, Redis-Server. .TP .B stop .br -Stop services NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server. +Stop services NGINX, PHP7.2-FPM, MySQL, Redis-Server. .TP .B reload .br -Reload services NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server. +Reload services NGINX, PHP7.2-FPM, MySQL, Redis-Server. .TP .B restart .br -Restart services NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server. +Restart services NGINX, PHP7.2-FPM, MySQL, Redis-Server. .TP .B site .br @@ -129,13 +129,13 @@ Disable site by Destroying softlink with site file in .br Edit NGINX configuration of site. .TP -.B create [ example.com ] [ --html | --php | --php72 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm ]] +.B create [ example.com ] [ --html | --php | --php73 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis | --hhvm ]] .br Create new site according to given options. If no options provided .br create static site with html only. .TP -.B update [ example.com ] [ --html | --php | --php72 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [ --wpsc | --w3tc | --wpfc | --wpredis | --hhvm ] [--password]] +.B update [ example.com ] [ --html | --php | --php73 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [ --wpsc | --wpfc | --wpredis | --hhvm ] [--password]] .br Update site configuration according to specified options. .TP @@ -143,7 +143,7 @@ Update site configuration according to specified options. .br Delete site i.e webroot, database, ad configuration permanently. .TP -.B debug [ -i | --nginx=on/off | --php=on/off | --php72=on/off | --mysql=on/off | --rewrite=on/off | --fpm=on/off | --fpm7=on/off ] +.B debug [ -i | --nginx=on/off | --php=on/off | --php73=on/off | --mysql=on/off | --rewrite=on/off | --fpm=on/off | --fpm7=on/off ] .br Starts server level debugging. If this is used without arguments it will start debugging .br @@ -182,7 +182,7 @@ used with wo debug command. used to start or stop nginx debugging. .br used with wo debug command. used to start or stop php debugging. .TP -.B --php72=on/off +.B --php73=on/off .br used with wo debug command. used to start or stop php72 debugging. .TP @@ -315,4 +315,4 @@ Report bugs at .br .B Rajdeep Sharma .I \ -.br \ No newline at end of file +.br diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 7ef7294..ac2dbbb 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -254,13 +254,22 @@ class WOStackController(CementBaseController): wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/conf.d/map-wp-fastcgi-cache.conf') - wo_nginx = open('/etc/nginx/conf.d/map-wp-fastcgi-cache.conf', + 'file /etc/nginx/conf.d/map-wp.conf') + wo_nginx = open('/etc/nginx/conf.d/map-wp.conf', encoding='utf-8', mode='w') - self.app.render((data), 'fastcgi-cache.mustache', + self.app.render((data), 'map-wp.mustache', out=wo_nginx) wo_nginx.close() + if not (os.path.isfile('/etc/nginx/conf.d/webp.conf')): + Log.debug(self, 'Writting the nginx configuration to ' + 'file /etc/nginx/conf.d/webp.conf') + wo_nginx = open('/etc/nginx/conf.d/webp.conf', + encoding='utf-8', mode='w') + self.app.render((data), 'webp.mustache', + out=wo_nginx) + wo_nginx.close() + # Setup Nginx common directory if not os.path.exists('/etc/nginx/common'): Log.debug(self, 'Creating directory' @@ -317,8 +326,8 @@ class WOStackController(CementBaseController): wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsubdir-php72.conf') - wo_nginx = open('/etc/nginx/common/wpsubdir-php72.conf', + 'file /etc/nginx/common/wpsubdir.conf') + wo_nginx = open('/etc/nginx/common/wpsubdir.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpsubdir.mustache', out=wo_nginx) diff --git a/wo/cli/templates/redis-php7.mustache b/wo/cli/templates/redis-php7.mustache index 42779bb..217509d 100644 --- a/wo/cli/templates/redis-php7.mustache +++ b/wo/cli/templates/redis-php7.mustache @@ -1,21 +1,7 @@ # Redis NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -set $skip_cache 0; -# POST requests and URL with a query string should always go to php -if ($request_method = POST) { - set $skip_cache 1; -} -if ($query_string != "") { - set $skip_cache 1; -} -# Don't cache URL containing the following segments -if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") { - set $skip_cache 1; -} -# Don't use the cache for logged in users or recent commenter or customer with items in cart -if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") { - set $skip_cache 1; -} +# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf + # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; diff --git a/wo/cli/templates/redis.mustache b/wo/cli/templates/redis.mustache index 273a1c3..0a7004f 100644 --- a/wo/cli/templates/redis.mustache +++ b/wo/cli/templates/redis.mustache @@ -1,21 +1,7 @@ # Redis NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -set $skip_cache 0; -# POST requests and URL with a query string should always go to php -if ($request_method = POST) { - set $skip_cache 1; -} -if ($query_string != "") { - set $skip_cache 1; -} -# Don't cache URL containing the following segments -if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") { - set $skip_cache 1; -} -# Don't use the cache for logged in users or recent commenter or customer with items in cart -if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") { - set $skip_cache 1; -} +# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf + # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; diff --git a/wo/cli/templates/virtualconf-php7.mustache b/wo/cli/templates/virtualconf-php7.mustache index 43baa33..bc58b9c 100644 --- a/wo/cli/templates/virtualconf-php7.mustache +++ b/wo/cli/templates/virtualconf-php7.mustache @@ -39,7 +39,7 @@ server { {{/static}} {{^static}}include {{^hhvm}}{{#basic}}common/php73.conf;{{/basic}}{{#wpfc}}common/wpfc-php73.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php73.conf;{{/wpsc}}{{#wpredis}}common/redis-php73.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} - {{#wpsubdir}}include common/wpsubdir-php73.conf;{{/wpsubdir}}{{/static}} + {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} {{#wp}}include common/wpcommon-php73.conf;{{/wp}} {{^proxy}}include common/locations-php73.conf;{{/proxy}} {{^vma}}{{^rc}}include {{webroot}}/conf/nginx/*.conf;{{/rc}}{{/vma}} diff --git a/wo/cli/templates/virtualconf.mustache b/wo/cli/templates/virtualconf.mustache index 3e41457..2fbd321 100644 --- a/wo/cli/templates/virtualconf.mustache +++ b/wo/cli/templates/virtualconf.mustache @@ -38,7 +38,7 @@ server { } {{/static}} - {{^static}}include {{^hhvm}}{{#basic}}common/php72.conf;{{/basic}}{{#wpfc}}common/wpfc-php72.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php72.conf;{{/wpsc}}{{#wpredis}}common/redis-php72.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} {{#wpsubdir}}include common/wpsubdir-php72.conf;{{/wpsubdir}}{{/static}} + {{^static}}include {{^hhvm}}{{#basic}}common/php72.conf;{{/basic}}{{#wpfc}}common/wpfc-php72.conf;{{/wpfc}} {{#wpsc}}common/wpsc-php72.conf;{{/wpsc}}{{#wpredis}}common/redis-php72.conf;{{/wpredis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} {{#wp}}include common/wpcommon-php72.conf;{{/wp}} {{^proxy}}include common/locations-php72.conf;{{/proxy}} {{^vma}}{{^rc}}include {{webroot}}/conf/nginx/*.conf;{{/rc}}{{/vma}} diff --git a/wo/cli/templates/webp.mustache b/wo/cli/templates/webp.mustache new file mode 100644 index 0000000..db3aac4 --- /dev/null +++ b/wo/cli/templates/webp.mustache @@ -0,0 +1,7 @@ +# WEBP NGINX CONFIGURATION +# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE + +map $http_accept $webp_suffix { + default ""; + "~*webp" ".webp"; +} \ No newline at end of file diff --git a/wo/cli/templates/wpfc-hhvm.mustache b/wo/cli/templates/wpfc-hhvm.mustache index 6326d5d..d0b3f92 100644 --- a/wo/cli/templates/wpfc-hhvm.mustache +++ b/wo/cli/templates/wpfc-hhvm.mustache @@ -1,21 +1,7 @@ # WPFC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -set $skip_cache 0; -# POST requests and URL with a query string should always go to php -if ($request_method = POST) { - set $skip_cache 1; -} -if ($query_string != "") { - set $skip_cache 1; -} -# Don't cache URL containing the following segments -if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") { - set $skip_cache 1; -} -# Don't use the cache for logged in users or recent commenter or customer with items in cart -if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") { - set $skip_cache 1; -} +# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf + # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; diff --git a/wo/cli/templates/wpfc-php7.mustache b/wo/cli/templates/wpfc-php7.mustache index 438aab2..aa7f087 100644 --- a/wo/cli/templates/wpfc-php7.mustache +++ b/wo/cli/templates/wpfc-php7.mustache @@ -1,7 +1,8 @@ # WPFC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -# $skip_cache variable set in /etc/nginx/conf.d/map-wp-fastcgi-cache.conf +# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf +add_header X-fastcgi-cache $upstream_cache_status; # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; diff --git a/wo/cli/templates/wpfc.mustache b/wo/cli/templates/wpfc.mustache index 6ad47d0..12258d8 100644 --- a/wo/cli/templates/wpfc.mustache +++ b/wo/cli/templates/wpfc.mustache @@ -1,7 +1,8 @@ # WPFC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -# $skip_cache variable set in /etc/nginx/conf.d/map-wp-fastcgi-cache.conf +# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf +add_header X-fastcgi-cache $upstream_cache_status; # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php$is_args$args; diff --git a/wo/cli/templates/wpsc-hhvm.mustache b/wo/cli/templates/wpsc-hhvm.mustache index 8006d52..4040a4c 100644 --- a/wo/cli/templates/wpsc-hhvm.mustache +++ b/wo/cli/templates/wpsc-hhvm.mustache @@ -1,21 +1,7 @@ # WPSC NGINX CONFIGURATION # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE -set $cache_uri $request_uri; -# POST requests and URL with a query string should always go to php -if ($request_method = POST) { - set $cache_uri 'null cache'; -} -if ($query_string != "") { - set $cache_uri 'null cache'; -} -# Don't cache URL containing the following segments -if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") { - set $cache_uri 'null cache'; -} -# Don't use the cache for logged in users or recent commenter or customer with items in cart -if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") { - set $cache_uri 'null cache'; -} +# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf + # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { # If we add index.php?$args its break WooCommerce like plugins diff --git a/wo/cli/templates/wpsc-php7.mustache b/wo/cli/templates/wpsc-php7.mustache index 3089a2d..9c5267e 100644 --- a/wo/cli/templates/wpsc-php7.mustache +++ b/wo/cli/templates/wpsc-php7.mustache @@ -1,5 +1,6 @@ # WPSC NGINX CONFIGURATION # 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 # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { diff --git a/wo/cli/templates/wpsc.mustache b/wo/cli/templates/wpsc.mustache index 853399f..d1f795c 100644 --- a/wo/cli/templates/wpsc.mustache +++ b/wo/cli/templates/wpsc.mustache @@ -1,5 +1,6 @@ # WPSC NGINX CONFIGURATION # 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 # Use cached or actual file if they exists, Otherwise pass request to WordPress location / {