Update 'NGINX-Installer.sh'
This commit is contained in:
@@ -32,7 +32,9 @@ mysql -u root -p"$password" -e "FLUSH PRIVILEGES;"
|
|||||||
mysql -u root -p"$password" -e "SELECT user,authentication_string,plugin,host FROM mysql.user;"
|
mysql -u root -p"$password" -e "SELECT user,authentication_string,plugin,host FROM mysql.user;"
|
||||||
cat <<EOF > /etc/nginx/sites-available/"$domain"
|
cat <<EOF > /etc/nginx/sites-available/"$domain"
|
||||||
fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=MYAPP:100m max_size=10g inactive=1440m;
|
fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=MYAPP:100m max_size=10g inactive=1440m;
|
||||||
|
|
||||||
|
#netdata placeholder
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
@@ -169,70 +171,6 @@ http {
|
|||||||
include /etc/nginx/sites-enabled/*;
|
include /etc/nginx/sites-enabled/*;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
cat <<EOF > /etc/nginx/sites-available/default
|
|
||||||
#fastcgi_cache_key \$scheme\$request_method\$host\$request_uri;
|
|
||||||
#add_header X-Cache "\$upstream_cache_status";
|
|
||||||
|
|
||||||
#add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
||||||
#ssl_session_cache shared:SSL:20m;
|
|
||||||
#ssl_session_timeout 180m;
|
|
||||||
#client_body_buffer_size 10K;
|
|
||||||
#client_header_buffer_size 1k;
|
|
||||||
#client_max_body_size 8m;
|
|
||||||
#large_client_header_buffers 4 4k;
|
|
||||||
#access_log off;
|
|
||||||
|
|
||||||
upstream netdata {
|
|
||||||
server 127.0.0.1:19999;
|
|
||||||
keepalive 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80 default_server;
|
|
||||||
listen [::]:80 default_server;
|
|
||||||
|
|
||||||
location = /netdata {
|
|
||||||
return 301 /netdata/;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ /netdata/(?<ndpath>.*) {
|
|
||||||
proxy_redirect off;
|
|
||||||
proxy_set_header Host \$host;
|
|
||||||
|
|
||||||
proxy_set_header X-Forwarded-Host \$host;
|
|
||||||
proxy_set_header X-Forwarded-Server \$host;
|
|
||||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_pass_request_headers on;
|
|
||||||
proxy_set_header Connection "keep-alive";
|
|
||||||
proxy_store off;
|
|
||||||
proxy_pass http://netdata/\$ndpath\$is_args\$args;
|
|
||||||
|
|
||||||
gzip on;
|
|
||||||
gzip_proxied any;
|
|
||||||
gzip_types *;
|
|
||||||
}
|
|
||||||
|
|
||||||
root /var/www/html;
|
|
||||||
index index.php index.html index.htm index.nginx-debian.html;
|
|
||||||
|
|
||||||
server_name _;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files \$uri \$uri/ =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
# pass PHP scripts to FastCGI server
|
|
||||||
location ~ \.php\$ {
|
|
||||||
include snippets/fastcgi-php.conf;
|
|
||||||
|
|
||||||
# With php-fpm (or other unix sockets):
|
|
||||||
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
|
|
||||||
# With php-cgi (or other tcp sockets):
|
|
||||||
#fastcgi_pass 127.0.0.1:9000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/
|
ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/
|
||||||
sed -i 's/#cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/7.2/fpm/php.ini
|
sed -i 's/#cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/7.2/fpm/php.ini
|
||||||
|
|
||||||
@@ -287,11 +225,11 @@ newaliases
|
|||||||
# Netdata #
|
# Netdata #
|
||||||
##-------------##
|
##-------------##
|
||||||
|
|
||||||
if [ $netdata = 1 ]
|
if [ $netdata = 1 ]; then
|
||||||
then
|
|
||||||
apt install -y netdata
|
apt install -y netdata
|
||||||
sed -i 's/SEND_EMAIL="YES"/SEND_EMAIL="NO"/g' /etc/netdata/health_alarm_notify.conf
|
sed -i 's/SEND_EMAIL="YES"/SEND_EMAIL="NO"/g' /etc/netdata/health_alarm_notify.conf
|
||||||
ufw allow 19999/tcp
|
ufw allow 19999/tcp
|
||||||
|
sed -i 's+#netdata placeholder+upstream netdata {\n server 127.0.0.1:19999;\n keepalive 64;\n}+g'
|
||||||
sed -i 's+#netdata here+location = /netdata {\n return 301 /netdata/;\n }\n\n location ~ /netdata/(?<ndpath>.*) {\n proxy_redirect off;\n proxy_set_header Host \$host;\n proxy_set_header X-Forwarded-Host \$host;\n proxy_set_header X-Forwarded-Server \$host;\n proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;\n proxy_http_version 1.1;\n proxy_pass_request_headers on;\n proxy_set_header Connection "keep-alive";\n proxy_store off;\n proxy_pass http://netdata/\$ndpath\$is_args\$args;\n }+g' /etc/nginx/sites-available/"$domain"
|
sed -i 's+#netdata here+location = /netdata {\n return 301 /netdata/;\n }\n\n location ~ /netdata/(?<ndpath>.*) {\n proxy_redirect off;\n proxy_set_header Host \$host;\n proxy_set_header X-Forwarded-Host \$host;\n proxy_set_header X-Forwarded-Server \$host;\n proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;\n proxy_http_version 1.1;\n proxy_pass_request_headers on;\n proxy_set_header Connection "keep-alive";\n proxy_store off;\n proxy_pass http://netdata/\$ndpath\$is_args\$args;\n }+g' /etc/nginx/sites-available/"$domain"
|
||||||
# systemctl stop netdata
|
# systemctl stop netdata
|
||||||
# systemctl disable netdata
|
# systemctl disable netdata
|
||||||
@@ -301,8 +239,7 @@ fi
|
|||||||
# Memcached #
|
# Memcached #
|
||||||
##---------------##
|
##---------------##
|
||||||
|
|
||||||
if [ $memcached = 1 ]
|
if [ $memcached = 1 ]; then
|
||||||
then
|
|
||||||
apt install -y memcached
|
apt install -y memcached
|
||||||
# systemctl stop memcached
|
# systemctl stop memcached
|
||||||
# systemctl disable memcached
|
# systemctl disable memcached
|
||||||
@@ -312,8 +249,7 @@ fi
|
|||||||
# Redis #
|
# Redis #
|
||||||
##-----------##
|
##-----------##
|
||||||
|
|
||||||
if [ $redis = 1 ]
|
if [ $redis = 1 ]; then
|
||||||
then
|
|
||||||
apt install -y redis-server
|
apt install -y redis-server
|
||||||
sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf
|
sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf
|
||||||
sed -i 's/# bind 127.0.0.1 ::1/bind 127.0.0.1 ::1/g' /etc/redis/redis.conf
|
sed -i 's/# bind 127.0.0.1 ::1/bind 127.0.0.1 ::1/g' /etc/redis/redis.conf
|
||||||
@@ -338,10 +274,10 @@ sed -i 's#include /etc/letsencrypt/options-ssl-nginx.conf;#ssl_ciphers EECDH+CHA
|
|||||||
# Wordpress #
|
# Wordpress #
|
||||||
##---------------##
|
##---------------##
|
||||||
|
|
||||||
if [ $wordpress = 1 ]
|
if [ $wordpress = 1 ]; then
|
||||||
then
|
db_suffix=$(ls -l /var/www | grep -c ^d)
|
||||||
db_name="wp_1"
|
db_name="wp_$db_suffix"
|
||||||
db_user="wp_1"
|
db_user="wp_$db_suffix"
|
||||||
db_pass=$(date +%s|sha256sum|base64|head -c 32)
|
db_pass=$(date +%s|sha256sum|base64|head -c 32)
|
||||||
mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
|
mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
|
||||||
mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"
|
mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"
|
||||||
@@ -350,7 +286,6 @@ if [ $wordpress = 1 ]
|
|||||||
tar xzvf /tmp/wp.tar.gz -C /tmp
|
tar xzvf /tmp/wp.tar.gz -C /tmp
|
||||||
mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
|
mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
|
||||||
cp -a /tmp/wordpress/. /var/www/"$domain"/html
|
cp -a /tmp/wordpress/. /var/www/"$domain"/html
|
||||||
chown -R www-data:www-data /var/www/"$domain"/html
|
|
||||||
WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -)
|
WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -)
|
||||||
cat <<EOF > /var/www/"$domain"/html/wp-config.php
|
cat <<EOF > /var/www/"$domain"/html/wp-config.php
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
Reference in New Issue
Block a user