mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 15:32:35 +00:00
use blade as conmmands template (#444)
* use blade as conmmands template * fix lint * fix ssl
This commit is contained in:
14
resources/views/ssh/services/database/mariadb/install-1011.blade.php
Executable file
14
resources/views/ssh/services/database/mariadb/install-1011.blade.php
Executable file
@ -0,0 +1,14 @@
|
||||
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.11"
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install mariadb-server mariadb-backup -y
|
||||
|
||||
sudo systemctl unmask mysql.service
|
||||
|
||||
sudo service mysql start
|
14
resources/views/ssh/services/database/mariadb/install-103.blade.php
Executable file
14
resources/views/ssh/services/database/mariadb/install-103.blade.php
Executable file
@ -0,0 +1,14 @@
|
||||
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-get update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install mariadb-server mariadb-backup -y
|
||||
|
||||
sudo systemctl unmask mysql.service
|
||||
|
||||
sudo service mysql start
|
14
resources/views/ssh/services/database/mariadb/install-104.blade.php
Executable file
14
resources/views/ssh/services/database/mariadb/install-104.blade.php
Executable file
@ -0,0 +1,14 @@
|
||||
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.4"
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install mariadb-server mariadb-backup -y
|
||||
|
||||
sudo systemctl unmask mysql.service
|
||||
|
||||
sudo service mysql start
|
14
resources/views/ssh/services/database/mariadb/install-106.blade.php
Executable file
14
resources/views/ssh/services/database/mariadb/install-106.blade.php
Executable file
@ -0,0 +1,14 @@
|
||||
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.6"
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install mariadb-server mariadb-backup -y
|
||||
|
||||
sudo systemctl unmask mysql.service
|
||||
|
||||
sudo service mysql start
|
14
resources/views/ssh/services/database/mariadb/install-114.blade.php
Executable file
14
resources/views/ssh/services/database/mariadb/install-114.blade.php
Executable file
@ -0,0 +1,14 @@
|
||||
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-11.4"
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install mariadb-server mariadb-backup -y
|
||||
|
||||
sudo systemctl unmask mysql.service
|
||||
|
||||
sudo service mysql start
|
@ -0,0 +1,9 @@
|
||||
sudo service mysql stop
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get remove mariadb-server mariadb-backup -y
|
||||
|
||||
sudo rm -rf /etc/mysql
|
||||
sudo rm -rf /var/lib/mysql
|
||||
sudo rm -rf /var/log/mysql
|
||||
sudo rm -rf /var/run/mysqld
|
||||
sudo rm -rf /var/run/mysqld/mysqld.sock
|
11
resources/views/ssh/services/database/mysql/backup.blade.php
Normal file
11
resources/views/ssh/services/database/mysql/backup.blade.php
Normal 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
|
9
resources/views/ssh/services/database/mysql/create-user.blade.php
Executable file
9
resources/views/ssh/services/database/mysql/create-user.blade.php
Executable 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"
|
5
resources/views/ssh/services/database/mysql/create.blade.php
Executable file
5
resources/views/ssh/services/database/mysql/create.blade.php
Executable 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"
|
9
resources/views/ssh/services/database/mysql/delete-user.blade.php
Executable file
9
resources/views/ssh/services/database/mysql/delete-user.blade.php
Executable 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"
|
5
resources/views/ssh/services/database/mysql/delete.blade.php
Executable file
5
resources/views/ssh/services/database/mysql/delete.blade.php
Executable 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"
|
15
resources/views/ssh/services/database/mysql/install-57.blade.php
Executable file
15
resources/views/ssh/services/database/mysql/install-57.blade.php
Executable file
@ -0,0 +1,15 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install mysql-server -y
|
||||
|
||||
sudo systemctl unmask mysql.service
|
||||
|
||||
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
|
17
resources/views/ssh/services/database/mysql/install-80.blade.php
Executable file
17
resources/views/ssh/services/database/mysql/install-80.blade.php
Executable file
@ -0,0 +1,17 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install mysql-server -y
|
||||
|
||||
sudo systemctl unmask mysql.service
|
||||
|
||||
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
|
27
resources/views/ssh/services/database/mysql/install-84.blade.php
Executable file
27
resources/views/ssh/services/database/mysql/install-84.blade.php
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y lsb-release
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive wget https://dev.mysql.com/get/mysql-apt-config_0.8.32-1_all.deb
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive dpkg -i mysql-apt-config_0.8.32-1_all.deb
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server
|
||||
|
||||
sudo systemctl unmask mysql.service
|
||||
|
||||
sudo systemctl enable mysql
|
||||
|
||||
sudo systemctl start mysql
|
||||
|
||||
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
|
9
resources/views/ssh/services/database/mysql/link.blade.php
Executable file
9
resources/views/ssh/services/database/mysql/link.blade.php
Executable 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"
|
@ -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
|
9
resources/views/ssh/services/database/mysql/uninstall.blade.php
Executable file
9
resources/views/ssh/services/database/mysql/uninstall.blade.php
Executable file
@ -0,0 +1,9 @@
|
||||
sudo service mysql stop
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get remove mysql-server -y
|
||||
|
||||
sudo rm -rf /etc/mysql
|
||||
sudo rm -rf /var/lib/mysql
|
||||
sudo rm -rf /var/log/mysql
|
||||
sudo rm -rf /var/run/mysqld
|
||||
sudo rm -rf /var/run/mysqld/mysqld.sock
|
5
resources/views/ssh/services/database/mysql/unlink.blade.php
Executable file
5
resources/views/ssh/services/database/mysql/unlink.blade.php
Executable 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"
|
@ -0,0 +1,19 @@
|
||||
if ! sudo -u postgres pg_dump -d {{ $database }} -f /var/lib/postgresql/{{ $file }}.sql; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo mv /var/lib/postgresql/{{ $file }}.sql /home/vito/{{ $file }}.sql; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo chown vito:vito /home/vito/{{ $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
|
5
resources/views/ssh/services/database/postgresql/create-user.blade.php
Executable file
5
resources/views/ssh/services/database/postgresql/create-user.blade.php
Executable file
@ -0,0 +1,5 @@
|
||||
if ! sudo -u postgres psql -c "CREATE ROLE \"{{ $username }}\" WITH LOGIN PASSWORD '{{ $password }}';"; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
echo "User {{ $username }} created"
|
@ -0,0 +1,5 @@
|
||||
if ! sudo -u postgres psql -c "CREATE DATABASE \"{{ $name }}\""; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
echo "Database {{ $name }} created"
|
5
resources/views/ssh/services/database/postgresql/delete-user.blade.php
Executable file
5
resources/views/ssh/services/database/postgresql/delete-user.blade.php
Executable file
@ -0,0 +1,5 @@
|
||||
if ! sudo -u postgres psql -c "DROP USER \"{{ $username }}\""; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
echo "User {{ $username }} deleted"
|
5
resources/views/ssh/services/database/postgresql/delete.blade.php
Executable file
5
resources/views/ssh/services/database/postgresql/delete.blade.php
Executable file
@ -0,0 +1,5 @@
|
||||
if ! sudo -u postgres psql -c "DROP DATABASE \"{{ $name }}\""; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
echo "Database {{ $name }} deleted"
|
@ -0,0 +1,11 @@
|
||||
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||
|
||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install postgresql-12 -y
|
||||
|
||||
systemctl status postgresql
|
||||
|
||||
sudo -u postgres psql -c "SELECT version();"
|
@ -0,0 +1,11 @@
|
||||
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||
|
||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install postgresql-13 -y
|
||||
|
||||
systemctl status postgresql
|
||||
|
||||
sudo -u postgres psql -c "SELECT version();"
|
@ -0,0 +1,11 @@
|
||||
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||
|
||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install postgresql-14 -y
|
||||
|
||||
systemctl status postgresql
|
||||
|
||||
sudo -u postgres psql -c "SELECT version();"
|
@ -0,0 +1,11 @@
|
||||
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||
|
||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install postgresql-15 -y
|
||||
|
||||
systemctl status postgresql
|
||||
|
||||
sudo -u postgres psql -c "SELECT version();"
|
@ -0,0 +1,11 @@
|
||||
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||
|
||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install postgresql-16 -y
|
||||
|
||||
systemctl status postgresql
|
||||
|
||||
sudo -u postgres psql -c "SELECT version();"
|
16
resources/views/ssh/services/database/postgresql/link.blade.php
Executable file
16
resources/views/ssh/services/database/postgresql/link.blade.php
Executable file
@ -0,0 +1,16 @@
|
||||
USER_TO_LINK='{{ $username }}'
|
||||
DB_NAME='{{ $database }}'
|
||||
DB_VERSION='{{ $version }}'
|
||||
|
||||
if ! sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"$DB_NAME\" TO $USER_TO_LINK;"; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
# Check if PostgreSQL version is 15 or greater
|
||||
if [ "$DB_VERSION" -ge 15 ]; then
|
||||
if ! sudo -u postgres psql -d "$DB_NAME" -c "GRANT USAGE, CREATE ON SCHEMA public TO $USER_TO_LINK;"; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Linking to $DB_NAME finished"
|
@ -0,0 +1,11 @@
|
||||
if ! DEBIAN_FRONTEND=noninteractive unzip {{ $file }}.zip; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo -u postgres psql -d {{ $database }} -f {{ $file }}.sql; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! rm {{ $file }}.sql {{ $file }}.zip; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
@ -0,0 +1,11 @@
|
||||
sudo service postgresql stop
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get remove postgresql-* -y
|
||||
|
||||
sudo rm -rf /etc/postgresql
|
||||
sudo rm -rf /var/lib/postgresql
|
||||
sudo rm -rf /var/log/postgresql
|
||||
sudo rm -rf /var/run/postgresql
|
||||
sudo rm -rf /var/run/postgresql/postmaster.pid
|
||||
sudo rm -rf /var/run/postgresql/.s.PGSQL.5432
|
||||
sudo rm -rf /var/run/postgresql/.s.PGSQL.5432.lock
|
16
resources/views/ssh/services/database/postgresql/unlink.blade.php
Executable file
16
resources/views/ssh/services/database/postgresql/unlink.blade.php
Executable file
@ -0,0 +1,16 @@
|
||||
USER_TO_REVOKE='{{ $username }}'
|
||||
DB_VERSION='{{ $version }}'
|
||||
|
||||
DATABASES=$(sudo -u postgres psql -t -c "SELECT datname FROM pg_database WHERE datistemplate = false;")
|
||||
|
||||
for DB in $DATABASES; do
|
||||
echo "Revoking privileges in database: $DB"
|
||||
sudo -u postgres psql -d "$DB" -c "REVOKE ALL PRIVILEGES ON DATABASE \"$DB\" FROM $USER_TO_REVOKE;"
|
||||
|
||||
# Check if PostgreSQL version is 15 or greater
|
||||
if [ "$DB_VERSION" -ge 15 ]; then
|
||||
sudo -u postgres psql -d "$DB" -c "REVOKE USAGE, CREATE ON SCHEMA public FROM $USER_TO_REVOKE;"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Privileges revoked from $USER_TO_REVOKE"
|
11
resources/views/ssh/services/firewall/ufw/add-rule.blade.php
Executable file
11
resources/views/ssh/services/firewall/ufw/add-rule.blade.php
Executable 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
|
27
resources/views/ssh/services/firewall/ufw/install-ufw.blade.php
Executable file
27
resources/views/ssh/services/firewall/ufw/install-ufw.blade.php
Executable 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
|
11
resources/views/ssh/services/firewall/ufw/remove-rule.blade.php
Executable file
11
resources/views/ssh/services/firewall/ufw/remove-rule.blade.php
Executable 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
|
@ -0,0 +1,53 @@
|
||||
arch=$(uname -m)
|
||||
|
||||
if [ "$arch" == "x86_64" ]; then
|
||||
executable="vitoagent-linux-amd64"
|
||||
elif [ "$arch" == "i686" ]; then
|
||||
executable="vitoagent-linux-amd"
|
||||
elif [ "$arch" == "armv7l" ]; then
|
||||
executable="vitoagent-linux-arm"
|
||||
elif [ "$arch" == "aarch64" ]; then
|
||||
executable="vitoagent-linux-arm64"
|
||||
else
|
||||
executable="vitoagent-linux-amd64"
|
||||
fi
|
||||
|
||||
wget {{ $downloadUrl }}/$executable
|
||||
|
||||
chmod +x ./$executable
|
||||
|
||||
sudo mv ./$executable /usr/local/bin/vito-agent
|
||||
|
||||
# create service
|
||||
export VITO_AGENT_SERVICE="
|
||||
[Unit]
|
||||
Description=Vito Agent
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
ExecStart=/usr/local/bin/vito-agent
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
"
|
||||
echo "${VITO_AGENT_SERVICE}" | sudo tee /etc/systemd/system/vito-agent.service
|
||||
|
||||
sudo mkdir -p /etc/vito-agent
|
||||
|
||||
export VITO_AGENT_CONFIG="
|
||||
{
|
||||
\"url\": \"{{ $configUrl }}\",
|
||||
\"secret\": \"{{ $configSecret }}\"
|
||||
}
|
||||
"
|
||||
|
||||
echo "${VITO_AGENT_CONFIG}" | sudo tee /etc/vito-agent/config.json
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable vito-agent
|
||||
sudo systemctl start vito-agent
|
||||
|
||||
echo "Vito Agent installed successfully"
|
@ -0,0 +1,13 @@
|
||||
sudo service vito-agent stop
|
||||
|
||||
sudo systemctl disable vito-agent
|
||||
|
||||
sudo rm -f /usr/local/bin/vito-agent
|
||||
|
||||
sudo rm -f /etc/systemd/system/vito-agent.service
|
||||
|
||||
sudo rm -rf /etc/vito-agent
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
echo "Vito Agent uninstalled successfully"
|
13
resources/views/ssh/services/nodejs/change-default-nodejs.blade.php
Executable file
13
resources/views/ssh/services/nodejs/change-default-nodejs.blade.php
Executable file
@ -0,0 +1,13 @@
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
|
||||
if ! nvm alias default {{ $version }}; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! nvm use default; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
echo "Default Node.js is now:"
|
||||
node -v
|
68
resources/views/ssh/services/nodejs/install-nodejs.blade.php
Executable file
68
resources/views/ssh/services/nodejs/install-nodejs.blade.php
Executable file
@ -0,0 +1,68 @@
|
||||
# Download NVM, if not already downloaded
|
||||
if [ ! -d "$HOME/.nvm" ]; then
|
||||
if ! git clone https://github.com/nvm-sh/nvm.git "$HOME/.nvm"; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Checkout the latest stable version of NVM
|
||||
if ! git -C "$HOME/.nvm" checkout v0.40.1; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
# Load NVM
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
|
||||
# Define the NVM initialization script
|
||||
NVM_INIT='
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
'
|
||||
|
||||
# List of potential configuration files
|
||||
CONFIG_FILES=("$HOME/.bash_profile" "$HOME/.bash_login" "$HOME/.profile")
|
||||
|
||||
# Flag to track if at least one file exists
|
||||
FILE_EXISTS=false
|
||||
|
||||
# Loop through each configuration file and check if it exists
|
||||
for config_file in "${CONFIG_FILES[@]}"; do
|
||||
if [ -f "$config_file" ]; then
|
||||
FILE_EXISTS=true
|
||||
# Check if the NVM initialization is already present
|
||||
if ! grep -q 'export NVM_DIR="$HOME/.nvm"' "$config_file"; then
|
||||
echo "Adding NVM initialization to $config_file"
|
||||
echo "$NVM_INIT" >> "$config_file"
|
||||
else
|
||||
echo "NVM initialization already exists in $config_file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# If no file exists, fallback to .profile
|
||||
if [ "$FILE_EXISTS" = false ]; then
|
||||
FALLBACK_FILE="$HOME/.profile"
|
||||
echo "No configuration files found. Creating $FALLBACK_FILE and adding NVM initialization."
|
||||
echo "$NVM_INIT" >> "$FALLBACK_FILE"
|
||||
fi
|
||||
|
||||
echo "NVM initialization process completed."
|
||||
|
||||
# Install NVM if not already installed
|
||||
if ! command -v nvm > /dev/null 2>&1; then
|
||||
if ! bash "$HOME/.nvm/install.sh"; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install the requested Node.js version
|
||||
if ! nvm install {{ $version }}; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
echo "Node.js version {{ $version }} installed successfully!"
|
||||
|
||||
echo "Node version:" && node -v
|
||||
echo "NPM version:" && npm -v
|
||||
echo "NPX version:" && npx -v
|
15
resources/views/ssh/services/nodejs/uninstall-nodejs.blade.php
Executable file
15
resources/views/ssh/services/nodejs/uninstall-nodejs.blade.php
Executable file
@ -0,0 +1,15 @@
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
|
||||
@if ($default)
|
||||
if ! nvm unalias default; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
if ! nvm deactivate; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
@endif
|
||||
|
||||
if ! nvm uninstall {{ $version }}; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
11
resources/views/ssh/services/php/change-default-php.blade.php
Executable file
11
resources/views/ssh/services/php/change-default-php.blade.php
Executable 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: "
|
||||
|
||||
php -v
|
22
resources/views/ssh/services/php/fpm-pool.blade.php
Normal file
22
resources/views/ssh/services/php/fpm-pool.blade.php
Normal file
@ -0,0 +1,22 @@
|
||||
[{{ $user }}]
|
||||
user = {{ $user }}
|
||||
group = {{ $user }}
|
||||
|
||||
listen = /run/php/php{{ $version }}-fpm-{{ $user }}.sock
|
||||
listen.owner = vito
|
||||
listen.group = vito
|
||||
listen.mode = 0660
|
||||
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
pm.max_requests = 500
|
||||
|
||||
php_admin_value[open_basedir] = /home/{{ $user }}/:/tmp/
|
||||
php_admin_value[upload_tmp_dir] = /home/{{ $user }}/tmp
|
||||
php_admin_value[session.save_path] = /home/{{ $user }}/tmp
|
||||
php_admin_value[display_errors] = off
|
||||
php_admin_value[log_errors] = on
|
||||
php_admin_value[error_log] = /home/{{ $user }}/.logs/php_errors.log
|
9
resources/views/ssh/services/php/install-composer.blade.php
Executable file
9
resources/views/ssh/services/php/install-composer.blade.php
Executable file
@ -0,0 +1,9 @@
|
||||
cd ~
|
||||
|
||||
curl -sS https://getcomposer.org/installer -o composer-setup.php
|
||||
|
||||
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
rm composer-setup.php
|
||||
|
||||
composer
|
@ -0,0 +1,5 @@
|
||||
sudo apt-get install -y php{{ $version }}-{{ $name }}
|
||||
|
||||
sudo service php{{ $version }}-fpm restart
|
||||
|
||||
php{{ $version }} -m
|
15
resources/views/ssh/services/php/install-php.blade.php
Executable file
15
resources/views/ssh/services/php/install-php.blade.php
Executable file
@ -0,0 +1,15 @@
|
||||
sudo add-apt-repository ppa:ondrej/php -y
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
|
||||
if ! sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php{{ $version }} php{{ $version }}-fpm php{{ $version }}-mbstring php{{ $version }}-mysql php{{ $version }}-gd php{{ $version }}-xml php{{ $version }}-curl php{{ $version }}-gettext php{{ $version }}-zip php{{ $version }}-bcmath php{{ $version }}-soap php{{ $version }}-redis php{{ $version }}-sqlite3 php{{ $version }}-tokenizer php{{ $version }}-pgsql php{{ $version }}-pdo; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
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
|
@ -0,0 +1,2 @@
|
||||
sudo rm -f /etc/php/{{ $version }}/fpm/pool.d/{{ $user }}.conf
|
||||
sudo service php{{ $version }}-fpm restart
|
5
resources/views/ssh/services/php/uninstall-php.blade.php
Executable file
5
resources/views/ssh/services/php/uninstall-php.blade.php
Executable file
@ -0,0 +1,5 @@
|
||||
sudo service php{{ $version }}-fpm stop
|
||||
|
||||
if ! sudo DEBIAN_FRONTEND=noninteractive apt-get 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 php{{ $version }}-sqlite3; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
@ -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
|
@ -0,0 +1,23 @@
|
||||
if ! sudo mkdir -p "$(dirname {{ $logFile }})"; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo touch {{ $logFile }}; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo chown {{ $user }}:{{ $user }} {{ $logFile }}; 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
|
@ -0,0 +1,19 @@
|
||||
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
|
@ -0,0 +1,5 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install supervisor -y
|
||||
|
||||
sudo service supervisor enable
|
||||
|
||||
sudo service supervisor start
|
@ -0,0 +1,3 @@
|
||||
if ! sudo supervisorctl restart {{ $id }}:*; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
@ -0,0 +1,3 @@
|
||||
if ! sudo supervisorctl start {{ $id }}:*; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
@ -0,0 +1,3 @@
|
||||
if ! sudo supervisorctl stop {{ $id }}:*; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
@ -0,0 +1,8 @@
|
||||
sudo service supervisor stop
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get remove supervisor -y
|
||||
|
||||
sudo rm -rf /etc/supervisor
|
||||
sudo rm -rf /var/log/supervisor
|
||||
sudo rm -rf /var/run/supervisor
|
||||
sudo rm -rf /var/run/supervisor/supervisor.sock
|
@ -0,0 +1,10 @@
|
||||
[program:{{ $name }}]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command={{ $command }}
|
||||
autostart={{ $autoStart }}
|
||||
autorestart={{ $autoRestart }}
|
||||
user={{ $user }}
|
||||
numprocs={{ $numprocs }}
|
||||
redirect_stderr=true
|
||||
stdout_logfile={{ $logFile }}
|
||||
stopwaitsecs=3600
|
7
resources/views/ssh/services/redis/install.blade.php
Executable file
7
resources/views/ssh/services/redis/install.blade.php
Executable file
@ -0,0 +1,7 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get 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
|
15
resources/views/ssh/services/redis/uninstall.blade.php
Executable file
15
resources/views/ssh/services/redis/uninstall.blade.php
Executable file
@ -0,0 +1,15 @@
|
||||
sudo service redis stop
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get remove redis-server -y
|
||||
|
||||
sudo rm -rf /etc/redis
|
||||
sudo rm -rf /var/lib/redis
|
||||
sudo rm -rf /var/log/redis
|
||||
sudo rm -rf /var/run/redis
|
||||
sudo rm -rf /var/run/redis/redis-server.pid
|
||||
sudo rm -rf /var/run/redis/redis-server.sock
|
||||
sudo rm -rf /var/run/redis/redis-server.sock
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive sudo apt-get autoremove -y
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive sudo apt-get autoclean -y
|
@ -0,0 +1,9 @@
|
||||
if ! sudo sed -i 's/php{{ $oldVersion }}/php{{ $newVersion }}/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 {{ $newVersion }}"
|
@ -0,0 +1,13 @@
|
||||
if ! sudo mkdir -p {{ $path }}; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! echo "{{ $certificate }}" | sudo tee {{ $certificatePath }}; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! echo "{{ $pk }}" | sudo tee {{ $pkPath }}; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
echo "Successfully received certificate."
|
@ -0,0 +1,3 @@
|
||||
if ! sudo certbot certonly --force-renewal --nginx --noninteractive --agree-tos --cert-name {{ $domain }} -m {{ $email }} {{ $domains }} --verbose; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
@ -0,0 +1,7 @@
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
rm -rf {{ $path }}
|
||||
|
||||
mkdir {{ $path }}
|
||||
|
||||
chmod -R 755 {{ $path }}
|
7
resources/views/ssh/services/webserver/nginx/create-vhost.blade.php
Executable file
7
resources/views/ssh/services/webserver/nginx/create-vhost.blade.php
Executable file
@ -0,0 +1,7 @@
|
||||
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
|
7
resources/views/ssh/services/webserver/nginx/delete-site.blade.php
Executable file
7
resources/views/ssh/services/webserver/nginx/delete-site.blade.php
Executable 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"
|
1
resources/views/ssh/services/webserver/nginx/get-vhost.blade.php
Executable file
1
resources/views/ssh/services/webserver/nginx/get-vhost.blade.php
Executable file
@ -0,0 +1 @@
|
||||
cat /etc/nginx/sites-available/{{ $domain }}
|
4
resources/views/ssh/services/webserver/nginx/install-nginx.blade.php
Executable file
4
resources/views/ssh/services/webserver/nginx/install-nginx.blade.php
Executable file
@ -0,0 +1,4 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install nginx -y
|
||||
|
||||
# install certbot
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install certbot python3-certbot-nginx -y
|
85
resources/views/ssh/services/webserver/nginx/nginx.blade.php
Executable file
85
resources/views/ssh/services/webserver/nginx/nginx.blade.php
Executable 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;
|
||||
# }
|
||||
#}
|
@ -0,0 +1,3 @@
|
||||
location {{ $from }} {
|
||||
return {{ $mode }} {{ $to }};
|
||||
}
|
12
resources/views/ssh/services/webserver/nginx/uninstall-nginx.blade.php
Executable file
12
resources/views/ssh/services/webserver/nginx/uninstall-nginx.blade.php
Executable file
@ -0,0 +1,12 @@
|
||||
sudo service nginx stop
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get purge nginx nginx-common nginx-full -y
|
||||
|
||||
sudo rm -rf /etc/nginx
|
||||
sudo rm -rf /var/log/nginx
|
||||
sudo rm -rf /var/lib/nginx
|
||||
sudo rm -rf /var/cache/nginx
|
||||
sudo rm -rf /usr/share/nginx
|
||||
sudo rm -rf /etc/systemd/system/nginx.service
|
||||
|
||||
sudo systemctl daemon-reload
|
@ -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
|
66
resources/views/ssh/services/webserver/nginx/vhost.blade.php
Executable file
66
resources/views/ssh/services/webserver/nginx/vhost.blade.php
Executable file
@ -0,0 +1,66 @@
|
||||
@if ($site->activeSsl && $site->force_ssl)
|
||||
server {
|
||||
listen 80;
|
||||
server_name {{ $site->domain }} {{ $site->getAliasesString() }};
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
@endif
|
||||
|
||||
server {
|
||||
@if (!$site->activeSsl || !$site->force_ssl)
|
||||
listen 80;
|
||||
@endif
|
||||
@if ($site->activeSsl)
|
||||
listen 443 ssl;
|
||||
ssl_certificate {{ $site->activeSsl->getCertificatePath() }};
|
||||
ssl_certificate_key {{ $site->activeSsl->getPkPath() }};
|
||||
@endif
|
||||
|
||||
server_name {{ $site->domain }} {{ $site->getAliasesString() }};
|
||||
root {{ $site->getWebDirectoryPath() }};
|
||||
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
|
||||
index index.html index.php;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
@if ($site->port)
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:{{ $site->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;
|
||||
}
|
||||
@elseif ($site->php_version)
|
||||
@php
|
||||
$phpSocket = 'unix:/var/run/php/php-fpm.sock';
|
||||
if ($site->isIsolated()) {
|
||||
$phpSocket = "unix:/run/php/php{$site->php_version}-fpm-{$site->user}.sock";
|
||||
}
|
||||
@endphp
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass {{ $phpSocket }};
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
fastcgi_hide_header X-Powered-By;
|
||||
}
|
||||
@endif
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user