Update 'NGINX-Installer.sh'
This commit is contained in:
@@ -30,7 +30,7 @@ mysql -u root -p"$password" -e "SELECT user,authentication_string,plugin,host FR
|
||||
mysql -u root -p"$password" -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '"$password"';"
|
||||
mysql -u root -p"$password" -e "FLUSH PRIVILEGES;"
|
||||
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;
|
||||
|
||||
server {
|
||||
@@ -42,23 +42,8 @@ server {
|
||||
#return 301 \$scheme:/\$domain\$request_uri; Redirect to non-www
|
||||
#return 301 https://domein.nl$request_uri; Redirect to other domain
|
||||
|
||||
location = /netdata {
|
||||
return 301 /netdata/;
|
||||
}
|
||||
#netdata here
|
||||
|
||||
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 text/plain text/css text/xml text/javascript application/x-javascript application/xml;
|
||||
@@ -206,7 +191,27 @@ server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
#netdata here
|
||||
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;
|
||||
@@ -228,7 +233,7 @@ server {
|
||||
}
|
||||
}
|
||||
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
|
||||
|
||||
##---------##
|
||||
@@ -245,7 +250,6 @@ sed -i 's/;opcache.max_accelerated_files=10000/opcache.max_accelerated_files=500
|
||||
sed -i 's/;opcache.max_wasted_percentage=5/opcache.max_wasted_percentage=5/g' /etc/php/7.2/fpm/php.ini
|
||||
sed -i 's/;opcache.revalidate_freq=2/opcache.revalidate_freq=0/g' /etc/php/7.2/fpm/php.ini
|
||||
sed -i 's/; max_input_vars = 1000/max_input_vars = 10000/g' /etc/php/7.2/fpm/php.ini
|
||||
sed -i 's/; max_input_vars = 1000/max_input_vars = 10000/g' /etc/php/7.2/fpm/php.ini
|
||||
sed -i 's/upload_max_filesize = 2/upload_max_filesize = 128/g' /etc/php/7.2/fpm/php.ini
|
||||
sed -i 's/post_max_size = 8/post_max_size = 64/g' /etc/php/7.2/fpm/php.ini
|
||||
|
||||
@@ -288,7 +292,7 @@ if [ $netdata = 1 ]
|
||||
apt install -y netdata
|
||||
sed -i 's/SEND_EMAIL="YES"/SEND_EMAIL="NO"/g' /etc/netdata/health_alarm_notify.conf
|
||||
ufw allow 19999/tcp
|
||||
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 gzip on\n gzip_proxied any;\n gzip_types *;\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'
|
||||
# systemctl stop netdata
|
||||
# systemctl disable netdata
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user