templates

New header message for all templates.
Admin-tools template moved.
Fixed permissions for PMA.
This commit is contained in:
Cristhian Martínez Ochoa 2022-09-21 16:45:24 -06:00
parent cc3ec5317c
commit c3e202f0c4
23 changed files with 150 additions and 54 deletions

View file

@ -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"

View file

@ -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/<port>/$(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}"

View file

@ -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

View file

@ -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"

View file

@ -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/<port>/$(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}"

View file

@ -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;

View file

@ -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";}

View file

@ -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;

View file

@ -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 " ";

View file

@ -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;

View file

@ -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/

View file

@ -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;

View file

@ -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$ {

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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/

View file

@ -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;

View file

@ -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;

View file

@ -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;
# }
#}