diff --git a/lib/general b/lib/general index f83efbd..28d568c 100644 --- a/lib/general +++ b/lib/general @@ -4,8 +4,8 @@ # Prevent 'tput' errors when running from Cron [[ -z $TERM || $TERM == "unknown" || $TERM == "dumb" ]] && export TERM=dumb -readonly app_version="1.16.7" -readonly svr_version="1.7" +readonly app_version="1.17.0" +readonly svr_version="1.8" readonly os_ubuntu_supported=(bionic focal jammy) # https://ubuntu.com/about/release-cycle readonly php_supported=(7.4 8.0 8.1) # https://www.php.net/supported-versions.php readonly php_default="8.1" diff --git a/lib/install b/lib/install index d32a2da..1423394 100644 --- a/lib/install +++ b/lib/install @@ -449,7 +449,7 @@ nginx_tool_site() { [[ -z $(conf_read tools-port) ]] && conf_write tools-port $tools_port_default sudo site $(conf_read tools-port) -empty > /dev/null 2>&1 - sudo cp /opt/webinoly/templates/nginx/admin_tools.conf /etc/nginx/sites-available/$(conf_read tools-port) + sudo cp /opt/webinoly/templates/general/admin_tools.conf /etc/nginx/sites-available/$(conf_read tools-port) sudo sed -i "s//$(conf_read tools-port)/g" /etc/nginx/sites-available/$(conf_read tools-port) sudo nginx -t && sudo systemctl reload nginx @@ -617,6 +617,7 @@ mysql_tool_pma() { sudo sed -i "/blowfish_secret/c \$cfg['blowfish_secret'] = '$(pwgen -s -1 32)';" /var/www/$(conf_read tools-port)/htdocs/pma/config.inc.php sudo chown -R www-data:www-data /var/www/$(conf_read tools-port)/htdocs/pma sudo find /var/www/$(conf_read tools-port)/htdocs/pma -type f -print0 | sudo xargs -r -0 chmod 644 + sudo find /var/www/$(conf_read tools-port)/htdocs/pma -type d -print0 | sudo xargs -r -0 chmod 755 conf_write mysql-tool-pma true echo "${gre}phpMyAdmin has been installed successfully! ${end}" diff --git a/lib/sites b/lib/sites index ea4cb5b..4222180 100644 --- a/lib/sites +++ b/lib/sites @@ -1022,13 +1022,13 @@ php_subfolder() { wp_subfolder() { php_subfolder - sudo sed -i "/^# DO NOT MODIFY, /a include apps.d/$domain$subname-wpcommon.conf;" /etc/nginx/apps.d/$domain$subname-php.conf + sudo sed -i "/^# Not remove these comments/a include apps.d/$domain$subname-wpcommon.conf;" /etc/nginx/apps.d/$domain$subname-php.conf sudo cp /etc/nginx/common/wpfc.conf /etc/nginx/apps.d/$domain$subname-wpfc.conf sudo sed -i "/^location \/ {/c location $subfolder/ {" /etc/nginx/apps.d/$domain$subname-wpfc.conf sudo sed -i "/^location ~\* /c location ~* $subfolder/\.*\\\.php\$ {" /etc/nginx/apps.d/$domain$subname-wpfc.conf sudo sed -i "s#/index.php#$subfolder/index.php#" /etc/nginx/apps.d/$domain$subname-wpfc.conf - sudo sed -i "/^# DO NOT MODIFY, /a include apps.d/$domain$subname-wpcommon.conf;" /etc/nginx/apps.d/$domain$subname-wpfc.conf + sudo sed -i "/^# Not remove these comments/a include apps.d/$domain$subname-wpcommon.conf;" /etc/nginx/apps.d/$domain$subname-wpfc.conf sudo cp /etc/nginx/common/wpcommon.conf /etc/nginx/apps.d/$domain$subname-wpcommon.conf sed -ri "s/location(.*) \/(.*) \{$/location\1 subfolder\/\2 \{/" /etc/nginx/apps.d/$domain$subname-wpcommon.conf @@ -1109,8 +1109,8 @@ wp_multisite_convertion() { sudo sed -i '/locations.conf/i \ include common/wpsubdir.conf;' /etc/nginx/sites-available/$domain else sudo cp /etc/nginx/common/wpsubdir.conf /etc/nginx/apps.d/$domain$subname-wpsubdir.conf - sudo sed -i "/DO NOT MODIFY/a \include apps.d\/$domain$subname-wpsubdir.conf;" /etc/nginx/apps.d/$domain$subname-php.conf - sudo sed -i "/DO NOT MODIFY/a \include apps.d\/$domain$subname-wpsubdir.conf;" /etc/nginx/apps.d/$domain$subname-wpfc.conf + sudo sed -i "/Not remove these comments/a \include apps.d\/$domain$subname-wpsubdir.conf;" /etc/nginx/apps.d/$domain$subname-php.conf + sudo sed -i "/Not remove these comments/a \include apps.d\/$domain$subname-wpsubdir.conf;" /etc/nginx/apps.d/$domain$subname-wpfc.conf sed -i "s#\^(#\^$subfolder\(#" /etc/nginx/apps.d/$domain$subname-wpsubdir.conf sed -i "s#\$2#$subfolder\$2#" /etc/nginx/apps.d/$domain$subname-wpsubdir.conf fi @@ -1526,12 +1526,12 @@ wp_cache() { sudo cat /etc/nginx/common/php.conf >> /etc/nginx/apps.d/$domain$subname-${fn}.conf fi - sudo sed -i '/# PHP NGINX CONFIGURATION/,/# DO NOT MODIFY, ALL/{/.*/d}' /etc/nginx/apps.d/$domain$subname-${fn}.conf + sudo sed -i '/This configuration file is only for internal use/,/# Not remove these comments/{/.*/d}' /etc/nginx/apps.d/$domain$subname-${fn}.conf sudo sed -i "/fastcgi_pass php;/a fastcgi_cache WORDPRESS;" /etc/nginx/apps.d/$domain$subname-${fn}.conf sudo sed -i "/fastcgi_pass php;/a fastcgi_no_cache \$skip_cache;" /etc/nginx/apps.d/$domain$subname-${fn}.conf sudo sed -i "/fastcgi_pass php;/a fastcgi_cache_bypass \$skip_cache;" /etc/nginx/apps.d/$domain$subname-${fn}.conf sudo sed -i '/fastcgi_cache WORDPRESS;/r /etc/nginx/conf.d/fastcgi.conf' /etc/nginx/apps.d/$domain$subname-${fn}.conf - sudo sed -i '/# FastCGI cache settings/,/fastcgi_cache_path /{/.*/d}' /etc/nginx/apps.d/$domain$subname-${fn}.conf + sudo sed -i '/This configuration file is only for internal use/,/fastcgi_cache_path /{/.*/d}' /etc/nginx/apps.d/$domain$subname-${fn}.conf sudo sed -i "/fastcgi_cache WORDPRESS;/c \ fastcgi_cache ${dom}${subname};" /etc/nginx/apps.d/$domain$subname-${fn}.conf sudo sed -i "s/ \$skip_cache/ \$skip_cache_${dom}${subname}/g" /etc/nginx/apps.d/$domain$subname-${fn}.conf sudo sed -i '/^fastcgi_/s/^/ /' /etc/nginx/apps.d/$domain$subname-${fn}.conf diff --git a/lib/verify b/lib/verify index 91d7400..f91b606 100644 --- a/lib/verify +++ b/lib/verify @@ -104,10 +104,6 @@ if [[ ! -f /opt/webinoly/templates/nginx/nginx.conf ]]; then echo "- [ERROR] File: /opt/webinoly/templates/nginx/nginx.conf not found!" local ver_one_err="1" fi -if [[ ! -f /opt/webinoly/templates/nginx/admin_tools.conf ]]; then - echo "- [ERROR] File: /opt/webinoly/templates/nginx/admin_tools.conf not found!" - local ver_one_err="1" -fi if [[ ! -f /opt/webinoly/templates/nginx/conf.d/fastcgi.conf ]]; then echo "- [ERROR] File: /opt/webinoly/templates/nginx/conf.d/fastcgi.conf not found!" local ver_one_err="1" @@ -172,6 +168,10 @@ if [[ ! -f /opt/webinoly/templates/nginx/common/wpsubdir.conf ]]; then echo "- [ERROR] File: /opt/webinoly/templates/nginx/common/wpsubdir.conf not found!" local ver_one_err="1" fi +if [[ ! -f /opt/webinoly/templates/general/admin_tools.conf ]]; then + echo "- [ERROR] File: /opt/webinoly/templates/general/admin_tools.conf not found!" + local ver_one_err="1" +fi if [[ ! -f /opt/webinoly/templates/general/conf ]]; then echo "- [ERROR] File: /opt/webinoly/templates/general/conf not found!" local ver_one_err="1" diff --git a/lib/webin b/lib/webin index cfce59e..f320ebb 100644 --- a/lib/webin +++ b/lib/webin @@ -622,7 +622,7 @@ set_tools_site() { echo "${gre}Domain${blu} ${tools_site}:$(conf_read tools-port) ${gre}was successfully assigned to access your server tools!${end}" elif [[ $tools_site == "default" ]]; then sudo rm -rf /etc/nginx/sites-available/$(conf_read tools-port) - sudo cp /opt/webinoly/templates/nginx/admin_tools.conf /etc/nginx/sites-available/$(conf_read tools-port) + sudo cp /opt/webinoly/templates/general/admin_tools.conf /etc/nginx/sites-available/$(conf_read tools-port) sudo sed -i "s//$(conf_read tools-port)/g" /etc/nginx/sites-available/$(conf_read tools-port) conf_write tools-site default echo "${gre}Tools Site settings has been reset successfully!${end}" diff --git a/templates/nginx/admin_tools.conf b/templates/general/admin_tools.conf similarity index 100% rename from templates/nginx/admin_tools.conf rename to templates/general/admin_tools.conf diff --git a/templates/nginx/common/acl.conf b/templates/nginx/common/acl.conf index 82a68ef..45d8287 100644 --- a/templates/nginx/common/acl.conf +++ b/templates/nginx/common/acl.conf @@ -1,4 +1,11 @@ -# HTTP authentication || IP address +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + satisfy any; auth_basic "Restricted Area"; auth_basic_user_file $authfile; diff --git a/templates/nginx/common/auth.conf b/templates/nginx/common/auth.conf index a257a9e..9f72892 100644 --- a/templates/nginx/common/auth.conf +++ b/templates/nginx/common/auth.conf @@ -1,2 +1,10 @@ +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + set $authfile ".htpasswd"; if ( -f /etc/nginx/apps.d/.htpasswd-$server_name ) {set $authfile "apps.d/.htpasswd-$server_name";} \ No newline at end of file diff --git a/templates/nginx/common/header.conf b/templates/nginx/common/header.conf index a5f903b..e446644 100644 --- a/templates/nginx/common/header.conf +++ b/templates/nginx/common/header.conf @@ -1,4 +1,10 @@ -# HTTP Headers +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### include common/headers-http.conf; include common/headers-html.conf; diff --git a/templates/nginx/common/headers-html.conf b/templates/nginx/common/headers-html.conf index 84502fb..a6dfaed 100644 --- a/templates/nginx/common/headers-html.conf +++ b/templates/nginx/common/headers-html.conf @@ -1,3 +1,11 @@ +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + add_header Cache-Control "no-cache"; add_header Referrer-Policy "no-referrer-when-downgrade"; #add_header Content-Security-Policy " "; diff --git a/templates/nginx/common/headers-http.conf b/templates/nginx/common/headers-http.conf index 22ec77d..1fb4086 100644 --- a/templates/nginx/common/headers-http.conf +++ b/templates/nginx/common/headers-http.conf @@ -1,3 +1,11 @@ +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + add_header X-Cache-Status $upstream_cache_status; add_header X-Frame-Options SAMEORIGIN; add_header X-Content-Type-Options nosniff; diff --git a/templates/nginx/common/headers-https.conf b/templates/nginx/common/headers-https.conf index eed6038..5278e96 100644 --- a/templates/nginx/common/headers-https.conf +++ b/templates/nginx/common/headers-https.conf @@ -1,3 +1,11 @@ +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + # Be aware that inclusion in the preload list cannot easily be undone. # Don't request inclusion unless you're sure that you can support HTTPS for your entire site and all its subdomains the long term. # https://hstspreload.org/ diff --git a/templates/nginx/common/headers.conf b/templates/nginx/common/headers.conf index c12c87e..be4feab 100644 --- a/templates/nginx/common/headers.conf +++ b/templates/nginx/common/headers.conf @@ -1,4 +1,10 @@ -# HTTP Headers with HTTPS +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### include common/headers-http.conf; include common/headers-html.conf; diff --git a/templates/nginx/common/locations.conf b/templates/nginx/common/locations.conf index 309bfb0..ff638c8 100644 --- a/templates/nginx/common/locations.conf +++ b/templates/nginx/common/locations.conf @@ -1,5 +1,11 @@ -# NGINX CONFIGURATION FOR COMMON LOCATION -# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE Webinoly +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + # Fallback robots.txt location (wp and proxy have higher priority if present) location ~* ^/robots.txt$ { diff --git a/templates/nginx/common/php.conf b/templates/nginx/common/php.conf index 5f79a6f..4ab4d0c 100644 --- a/templates/nginx/common/php.conf +++ b/templates/nginx/common/php.conf @@ -1,5 +1,12 @@ -# PHP NGINX CONFIGURATION -# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE Webinoly +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + +# Not remove these comments location / { try_files $uri $uri/ /index.php$is_args$args; diff --git a/templates/nginx/common/phpx.conf b/templates/nginx/common/phpx.conf index 4e42930..ccfdae8 100644 --- a/templates/nginx/common/phpx.conf +++ b/templates/nginx/common/phpx.conf @@ -1,5 +1,12 @@ -# PHP NGINX CONFIGURATION -# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE Webinoly +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + +# Not remove these comments location / { try_files $uri $uri/ /index.php$is_args$args; diff --git a/templates/nginx/common/wpcommon-noauth.conf b/templates/nginx/common/wpcommon-noauth.conf index 0f7b907..8cbbb94 100644 --- a/templates/nginx/common/wpcommon-noauth.conf +++ b/templates/nginx/common/wpcommon-noauth.conf @@ -1,5 +1,11 @@ -# WordPress COMMON SETTINGS -# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE Webinoly +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + # Limited Access (Only logged in users in wp-admin) # https://baraktawily.blogspot.com/2018/02/how-to-dos-29-of-world-wide-websites.html diff --git a/templates/nginx/common/wpcommon.conf b/templates/nginx/common/wpcommon.conf index ec314a3..d4df4c4 100644 --- a/templates/nginx/common/wpcommon.conf +++ b/templates/nginx/common/wpcommon.conf @@ -1,5 +1,11 @@ -# WordPress COMMON SETTINGS -# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE Webinoly +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + # Limited Access (Only logged in users in wp-admin) # https://baraktawily.blogspot.com/2018/02/how-to-dos-29-of-world-wide-websites.html diff --git a/templates/nginx/common/wpfc.conf b/templates/nginx/common/wpfc.conf index 426d557..9ea6863 100644 --- a/templates/nginx/common/wpfc.conf +++ b/templates/nginx/common/wpfc.conf @@ -1,5 +1,12 @@ -# WPFC NGINX CONFIGURATION -# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE Webinoly +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + +# Not remove these comments set $skip_cache 0; # URL with a query string should always go to php diff --git a/templates/nginx/common/wpsubdir.conf b/templates/nginx/common/wpsubdir.conf index 4c344ca..28b0940 100644 --- a/templates/nginx/common/wpsubdir.conf +++ b/templates/nginx/common/wpsubdir.conf @@ -1,5 +1,10 @@ -# WPSUBDIRECTORY NGINX CONFIGURATION -# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE Webinoly +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### if (!-e $request_filename) { # Redirect wp-admin to wp-admin/ diff --git a/templates/nginx/conf.d/fastcgi.conf b/templates/nginx/conf.d/fastcgi.conf index fabc771..dd1f1d5 100644 --- a/templates/nginx/conf.d/fastcgi.conf +++ b/templates/nginx/conf.d/fastcgi.conf @@ -1,4 +1,11 @@ -# FastCGI cache settings +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + fastcgi_cache_path /run/nginx-cache levels=1:2 keys_zone=WORDPRESS:50m max_size=100m inactive=7d; fastcgi_cache_key "$scheme$request_method$host$request_uri"; fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503; diff --git a/templates/nginx/conf.d/upstream.conf b/templates/nginx/conf.d/upstream.conf index 53f5ee5..49ec04f 100644 --- a/templates/nginx/conf.d/upstream.conf +++ b/templates/nginx/conf.d/upstream.conf @@ -1,4 +1,10 @@ -# Common upstream settings +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### upstream php { server 127.0.0.1:9000; diff --git a/templates/nginx/nginx.conf b/templates/nginx/nginx.conf index 0cba354..a6b8953 100644 --- a/templates/nginx/nginx.conf +++ b/templates/nginx/nginx.conf @@ -1,3 +1,11 @@ +# Webinoly (This configuration file is only for internal use) +##################################################################################################### +# Please, DO NOT MODIFY this file, all the changes will be lost. # +# If you need to modify any of the existing rules, use the proper command as indicated in the docs. # +# If you need to add your own custom rules, you can create a custom file as indicated in the docs. # +# Please, read the documentation: https://webinoly.com/documentation/ # +##################################################################################################### + user www-data; worker_processes auto; worker_rlimit_core 100000; @@ -132,24 +140,3 @@ http { include /etc/nginx/sites-enabled/*; } - -#mail { -# # See sample authentication script at: -# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript -# -# # auth_http localhost/auth.php; -# # pop3_capabilities "TOP" "USER"; -# # imap_capabilities "IMAP4rev1" "UIDPLUS"; -# -# server { -# listen localhost:110; -# protocol pop3; -# proxy on; -# } -# -# server { -# listen localhost:143; -# protocol imap; -# proxy on; -# } -#}