mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
refactoring
This commit is contained in:
9
resources/commands/webserver/nginx/change-php-version.sh
Executable file
9
resources/commands/webserver/nginx/change-php-version.sh
Executable 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__"
|
27
resources/commands/webserver/nginx/create-vhost.sh
Executable file
27
resources/commands/webserver/nginx/create-vhost.sh
Executable 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
|
7
resources/commands/webserver/nginx/delete-site.sh
Executable file
7
resources/commands/webserver/nginx/delete-site.sh
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"
|
8
resources/commands/webserver/nginx/install-nginx.sh
Executable file
8
resources/commands/webserver/nginx/install-nginx.sh
Executable 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
|
||||
|
85
resources/commands/webserver/nginx/nginx.conf
Executable file
85
resources/commands/webserver/nginx/nginx.conf
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;
|
||||
# }
|
||||
#}
|
38
resources/commands/webserver/nginx/php-vhost-ssl.conf
Executable file
38
resources/commands/webserver/nginx/php-vhost-ssl.conf
Executable 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;
|
||||
}
|
33
resources/commands/webserver/nginx/php-vhost.conf
Executable file
33
resources/commands/webserver/nginx/php-vhost.conf
Executable 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;
|
||||
}
|
31
resources/commands/webserver/nginx/phpmyadmin-vhost.conf
Executable file
31
resources/commands/webserver/nginx/phpmyadmin-vhost.conf
Executable 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;
|
||||
}
|
||||
}
|
3
resources/commands/webserver/nginx/redirect.conf
Normal file
3
resources/commands/webserver/nginx/redirect.conf
Normal file
@ -0,0 +1,3 @@
|
||||
location __from__ {
|
||||
return __mode__ __to__;
|
||||
}
|
36
resources/commands/webserver/nginx/reverse-vhost-ssl.conf
Executable file
36
resources/commands/webserver/nginx/reverse-vhost-ssl.conf
Executable 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;
|
||||
}
|
31
resources/commands/webserver/nginx/reverse-vhost.conf
Executable file
31
resources/commands/webserver/nginx/reverse-vhost.conf
Executable 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;
|
||||
}
|
7
resources/commands/webserver/nginx/update-redirects.sh
Normal file
7
resources/commands/webserver/nginx/update-redirects.sh
Normal 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
|
7
resources/commands/webserver/nginx/update-vhost.sh
Executable file
7
resources/commands/webserver/nginx/update-vhost.sh
Executable 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
|
32
resources/commands/webserver/nginx/vhost-ssl.conf
Executable file
32
resources/commands/webserver/nginx/vhost-ssl.conf
Executable 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;
|
||||
}
|
27
resources/commands/webserver/nginx/vhost.conf
Executable file
27
resources/commands/webserver/nginx/vhost.conf
Executable 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;
|
||||
}
|
Reference in New Issue
Block a user