refactoring

This commit is contained in:
Saeed Vaziry
2023-08-04 18:28:04 +02:00
parent 8444323cf4
commit 643318fcfc
349 changed files with 3189 additions and 2729 deletions

View File

@ -0,0 +1,7 @@
if ! echo '__data__' | sudo -u __user__ crontab -; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo -u __user__ crontab -l; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,12 @@
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
chmod +x mariadb_repo_setup
sudo DEBIAN_FRONTEND=noninteractive ./mariadb_repo_setup \
--mariadb-server-version="mariadb-10.3"
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt install mariadb-server mariadb-backup -y
sudo service mysql start

View File

@ -0,0 +1,19 @@
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
sudo DEBIAN_FRONTEND=noninteractive dpkg -i mysql-apt-config_0.8.22-1_all.deb
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt install mysql-server -y
sudo service mysql enable
sudo service mysql start
if ! sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH auth_socket;"; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo mysql -e "FLUSH PRIVILEGES"; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,13 @@
sudo DEBIAN_FRONTEND=noninteractive apt install mysql-server -y
sudo service mysql enable
sudo service mysql start
if ! sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH auth_socket;"; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo mysql -e "FLUSH PRIVILEGES"; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,11 @@
if ! sudo DEBIAN_FRONTEND=noninteractive mysqldump -u root __database__ > __file__.sql; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! DEBIAN_FRONTEND=noninteractive zip __file__.zip __file__.sql; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! rm __file__.sql; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,9 @@
if ! sudo mysql -e "CREATE USER IF NOT EXISTS '__username__'@'__host__' IDENTIFIED BY '__password__'"; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo mysql -e "FLUSH PRIVILEGES"; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "Command executed"

View File

@ -0,0 +1,5 @@
if ! sudo mysql -e "CREATE DATABASE IF NOT EXISTS __name__ CHARACTER SET utf8 COLLATE utf8_general_ci"; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "Command executed"

View File

@ -0,0 +1,9 @@
if ! sudo mysql -e "DROP USER IF EXISTS '__username__'@'__host__'"; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo mysql -e "FLUSH PRIVILEGES"; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "Command executed"

View File

@ -0,0 +1,5 @@
if ! sudo mysql -e "DROP DATABASE IF EXISTS __name__"; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "Command executed"

View File

@ -0,0 +1,9 @@
if ! sudo mysql -e "GRANT ALL PRIVILEGES ON __database__.* TO '__username__'@'__host__'"; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo mysql -e "FLUSH PRIVILEGES"; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "Linking to __database__ finished"

View File

@ -0,0 +1,11 @@
if ! DEBIAN_FRONTEND=noninteractive unzip __file__.zip; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo DEBIAN_FRONTEND=noninteractive mysql -u root __database__ < __file__.sql; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! rm __file__.sql __file__.zip; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,5 @@
if ! sudo mysql -e "REVOKE ALL PRIVILEGES, GRANT OPTION FROM '__username__'@'__host__'"; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "Command executed"

View File

@ -0,0 +1,11 @@
if ! sudo ufw __type__ from __source____mask__ to any proto __protocol__ port __port__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo ufw reload; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo service ufw restart; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,27 @@
if ! sudo ufw default deny incoming; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo ufw default allow outgoing; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo ufw allow from 0.0.0.0/0 to any proto tcp port 22; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo ufw allow from 0.0.0.0/0 to any proto tcp port 80; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo ufw allow from 0.0.0.0/0 to any proto tcp port 443; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo ufw --force enable; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo ufw reload; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,11 @@
if ! sudo ufw delete __type__ from __source____mask__ to any proto __protocol__ port __port__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo ufw reload; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo service ufw restart; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,5 @@
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -;
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt install nodejs -y

View File

@ -0,0 +1,7 @@
sudo DEBIAN_FRONTEND=noninteractive apt install redis-server -y
sudo sed -i 's/bind 127.0.0.1 ::1/bind 0.0.0.0/g' /etc/redis/redis.conf
sudo service redis enable
sudo service redis start

View File

@ -0,0 +1,3 @@
sudo DEBIAN_FRONTEND=noninteractive apt install -y software-properties-common curl zip unzip git gcc
git config --global user.email "__email__"
git config --global user.name "__name__"

View File

@ -0,0 +1,11 @@
if ! sudo rm /usr/bin/php; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo ln -s /usr/bin/php__version__ /usr/bin/php; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "Default php is: \n"
php -v

View File

@ -0,0 +1 @@
cat /etc/php/__version__/cli/php.ini

View File

@ -0,0 +1,7 @@
cd ~
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
composer

View File

@ -0,0 +1,5 @@
sudo apt install -y php__version__-__name__
sudo service php__version__-fpm restart
php__version__ -m

View File

@ -0,0 +1,13 @@
sudo add-apt-repository ppa:ondrej/php -y
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt install -y php__version__ php__version__-fpm php__version__-mbstring php__version__-mysql php__version__-mcrypt php__version__-gd php__version__-xml php__version__-curl php__version__-gettext php__version__-zip php__version__-bcmath php__version__-soap php__version__-redis
if ! sudo sed -i 's/www-data/__user__/g' /etc/php/__version__/fpm/pool.d/www.conf; then
echo 'VITO_SSH_ERROR' && exit 1
fi
sudo service php__version__-fpm enable
sudo service php__version__-fpm start

View File

@ -0,0 +1,5 @@
sudo service php__version__-fpm stop
if ! sudo DEBIAN_FRONTEND=noninteractive apt remove -y php__version__ php__version__-fpm php__version__-mbstring php__version__-mysql php__version__-mcrypt php__version__-gd php__version__-xml php__version__-curl php__version__-gettext php__version__-zip php__version__-bcmath php__version__-soap php__version__-redis; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,11 @@
if ! sudo sed -i 's,^__variable__ =.*$,__variable__ = __value__,' /etc/php/__version__/cli/php.ini; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo sed -i 's,^__variable__ =.*$,__variable__ = __value__,' /etc/php/__version__/fpm/php.ini; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo service php__version__-fpm restart; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,17 @@
if ! sudo chown -R 755 /home/vito/phpmyadmin; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! echo '__vhost__' | sudo tee /etc/nginx/sites-available/phpmyadmin; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo ln -s /etc/nginx/sites-available/phpmyadmin /etc/nginx/sites-enabled/; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo service nginx restart; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "PHPMyAdmin vhost created"

View File

@ -0,0 +1,11 @@
sudo rm -rf __path__
sudo rm /etc/nginx/sites-available/phpmyadmin
sudo rm /etc/nginx/sites-enabled/phpmyadmin
if ! sudo service nginx restart; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "PHPMyAdmin deleted"

View File

@ -0,0 +1,21 @@
sudo rm -rf phpmyadmin
if ! wget https://files.phpmyadmin.net/phpMyAdmin/5.1.2/phpMyAdmin-5.1.2-all-languages.zip; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! unzip phpMyAdmin-5.1.2-all-languages.zip; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! rm -rf phpMyAdmin-5.1.2-all-languages.zip; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! mv phpMyAdmin-5.1.2-all-languages phpmyadmin; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! mv phpmyadmin/config.sample.inc.php phpmyadmin/config.inc.php; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,3 @@
sudo service __service__ restart
sudo service __service__ status | cat

View File

@ -0,0 +1 @@
sudo service __service__ status | cat

View File

@ -0,0 +1,3 @@
sudo service __service__ start
sudo service __service__ status | cat

View File

@ -0,0 +1,3 @@
sudo service __service__ stop
sudo service __service__ status | cat

View File

@ -0,0 +1,13 @@
if ! sudo mkdir __path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! echo __certificate__ | sudo tee __certificate_path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! echo __pk__ | sudo tee __pk_path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "Successfully received certificate."

View File

@ -0,0 +1,3 @@
if ! sudo certbot certonly --force-renewal --nginx --noninteractive --agree-tos --cert-name __domain__ -m __email__ -d __domain__ --verbose; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1 @@
sudo DEBIAN_FRONTEND=noninteractive apt install certbot python3-certbot-nginx -y

View File

@ -0,0 +1,4 @@
curl -o __dest__ --location --request POST 'https://content.dropboxapi.com/2/files/download' \
--header 'Accept: application/json' \
--header 'Dropbox-API-Arg: {"path":"__src__"}' \
--header 'Authorization: Bearer __token__'

View File

@ -0,0 +1,6 @@
curl --location --request POST 'https://content.dropboxapi.com/2/files/upload' \
--header 'Accept: application/json' \
--header 'Dropbox-API-Arg: {"path":"__dest__"}' \
--header 'Content-Type: text/plain; charset=dropbox-cors-hack' \
--header 'Authorization: Bearer __token__' \
--data-binary '@__src__'

View File

@ -0,0 +1,21 @@
mkdir -p ~/.logs
mkdir -p ~/.logs/workers
touch ~/.logs/workers/__id__.log
if ! echo '__config__' | sudo tee /etc/supervisor/conf.d/__id__.conf; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo supervisorctl reread; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo supervisorctl update; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo supervisorctl start __id__:*; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,20 @@
if ! sudo supervisorctl stop __id__:*; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo rm -rf ~/.logs/workers/__id__.log; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo rm -rf /etc/supervisor/conf.d/__id__.conf; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo supervisorctl reread; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo supervisorctl update; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,5 @@
sudo DEBIAN_FRONTEND=noninteractive apt-get install supervisor -y
sudo service supervisor enable
sudo service supervisor start

View File

@ -0,0 +1,3 @@
if ! sudo supervisorctl restart __id__:*; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,3 @@
if ! sudo supervisorctl start __id__:*; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,3 @@
if ! sudo supervisorctl stop __id__:*; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,10 @@
[program:__name__]
process_name=%(program_name)s_%(process_num)02d
command=__command__
autostart=__auto_start__
autorestart=__auto_restart__
user=__user__
numprocs=__numprocs__
redirect_stderr=true
stdout_logfile=__log_file__
stopwaitsecs=3600

View File

@ -0,0 +1,11 @@
export DEBIAN_FRONTEND=noninteractive
echo "__key__" | sudo tee -a /home/root/.ssh/authorized_keys
sudo useradd -p $(openssl passwd -1 __password__) __user__
sudo usermod -aG sudo __user__
echo "__user__ ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers
sudo mkdir /home/__user__
sudo mkdir /home/__user__/.ssh
echo "__key__" | sudo tee -a /home/__user__/.ssh/authorized_keys
sudo chown -R __user__:__user__ /home/__user__
sudo chsh -s /bin/bash __user__
sudo su - __user__ -c "ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa" <<< y

View File

@ -0,0 +1 @@
sudo sed -i 's/__key__//g' ~/.ssh/authorized_keys

View File

@ -0,0 +1,3 @@
if ! echo '__key__' | sudo tee -a ~/.ssh/authorized_keys; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,3 @@
if ! echo "__content__" | tee __path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1 @@
ssh-keygen -t rsa -b 4096 -N "" -f ~/.ssh/__name__

View File

@ -0,0 +1 @@
cat ~/.ssh/id_rsa.pub

View File

@ -0,0 +1 @@
cat ~/.ssh/__name__.pub

View File

@ -0,0 +1,3 @@
echo "Rebooting..."
sudo reboot

View File

@ -0,0 +1,5 @@
if ! cd __path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
__script__

View File

@ -0,0 +1,7 @@
sudo DEBIAN_FRONTEND=noninteractive apt clean
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt upgrade -y
sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y

View File

@ -0,0 +1,9 @@
if ! sudo sed -i 's/php__old_version__/php__new_version__/g' /etc/nginx/sites-available/__domain__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo service nginx restart; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "PHP Version Changed to __new_version__"

View File

@ -0,0 +1,27 @@
if ! rm -rf __path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! mkdir __path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo chown -R 755 __path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! echo '' | sudo tee /etc/nginx/conf.d/__domain___redirects; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! echo '__vhost__' | sudo tee /etc/nginx/sites-available/__domain__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo ln -s /etc/nginx/sites-available/__domain__ /etc/nginx/sites-enabled/; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo service nginx restart; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,7 @@
rm -rf __path__
sudo rm /etc/nginx/sites-available/__domain__
sudo rm /etc/nginx/sites-enabled/__domain__
echo "Site deleted"

View File

@ -0,0 +1,8 @@
sudo DEBIAN_FRONTEND=noninteractive apt install nginx -y
if ! echo '__config__' | sudo tee /etc/nginx/nginx.conf; then
echo 'VITO_SSH_ERROR' && exit 1
fi
sudo service nginx start

View File

@ -0,0 +1,85 @@
user __user__;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
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;
# }
#}

View File

@ -0,0 +1,38 @@
server {
listen 80;
listen 443 ssl;
server_name __domain__ www.__domain__;
root __path__/__web_directory__;
ssl on;
ssl_certificate __certificate__;
ssl_certificate_key __private_key__;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php__php_version__-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
include conf.d/__domain___redirects;
}

View File

@ -0,0 +1,33 @@
server {
listen 80;
server_name __domain__ www.__domain__;
root __path__/__web_directory__;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php__php_version__-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
include conf.d/__domain___redirects;
}

View File

@ -0,0 +1,31 @@
server {
listen 54331;
server_name _;
root /home/vito/phpmyadmin;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php__php_version__-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}

View File

@ -0,0 +1,3 @@
location __from__ {
return __mode__ __to__;
}

View File

@ -0,0 +1,36 @@
server {
listen 80;
listen 443 ssl;
server_name __domain__ __aliases__;
root __path__;
ssl on;
ssl_certificate __certificate__;
ssl_certificate_key __private_key__;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
proxy_pass http://127.0.0.1:__port__/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $remote_addr;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ /\.(?!well-known).* {
deny all;
}
include conf.d/__domain___redirects;
}

View File

@ -0,0 +1,31 @@
server {
listen 80;
server_name __domain__ __aliases__;
root __path__;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
proxy_pass http://127.0.0.1:__port__/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $remote_addr;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ /\.(?!well-known).* {
deny all;
}
include conf.d/__domain___redirects;
}

View File

@ -0,0 +1,7 @@
if ! echo '__redirects__' | sudo tee /etc/nginx/conf.d/__domain___redirects; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo service nginx restart; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,7 @@
if ! echo '__vhost__' | sudo tee /etc/nginx/sites-available/__domain__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo service nginx restart; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,32 @@
server {
listen 80;
listen 443 ssl;
server_name __domain__ __aliases__;
root __path__/__web_directory__;
ssl on;
ssl_certificate __certificate__;
ssl_certificate_key __private_key__;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.html;
charset utf-8;
location / {
try_files $uri $uri/ /index.html;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.html;
location ~ /\.(?!well-known).* {
deny all;
}
include conf.d/__domain___redirects;
}

View File

@ -0,0 +1,27 @@
server {
listen 80;
server_name __domain__ __aliases__;
root __path__/__web_directory__;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.html;
charset utf-8;
location / {
try_files $uri $uri/ /index.html;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.html;
location ~ /\.(?!well-known).* {
deny all;
}
include conf.d/__domain___redirects;
}

View File

@ -0,0 +1,27 @@
echo "Host __host__-__key__
Hostname __host__
IdentityFile=~/.ssh/__key__" >> ~/.ssh/config
ssh-keyscan -H __host__ >> ~/.ssh/known_hosts
rm -rf __path__
if ! git config --global core.fileMode false; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! git clone -b __branch__ __repo__ __path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! find __path__ -type d -exec chmod 755 {} \;; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! find __path__ -type f -exec chmod 644 {} \;; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! cd __path__ && git config core.fileMode false; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,7 @@
if ! cd __path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,7 @@
if ! cd __path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! git checkout -f __branch__; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -0,0 +1,27 @@
if ! curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! chmod +x wp-cli.phar; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo mv wp-cli.phar /usr/local/bin/wp; then
echo 'VITO_SSH_ERROR' && exit 1
fi
rm -rf __path__
if ! wp --path=__path__ core download; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! wp --path=__path__ core config --dbname='__db_name__' --dbuser='__db_user__' --dbpass='__db_pass__' --dbhost='__db_host__' --dbprefix='__db_prefix__'; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! wp --path=__path__ core install --url='http://__domain__' --title="__title__" --admin_user='__username__' --admin_password="__password__" --admin_email='__email__'; then
echo 'VITO_SSH_ERROR' && exit 1
fi
print "Wordpress installed!"