Update 'RevProxySimple.sh'
This commit is contained in:
@@ -11,6 +11,8 @@
|
|||||||
# Pre-Config #
|
# Pre-Config #
|
||||||
##----------------##
|
##----------------##
|
||||||
|
|
||||||
|
# Set server IP variable for apache access
|
||||||
|
server_ip=$(hostname -I|cut -f1 -d ' ')
|
||||||
# Block direct apache acces
|
# Block direct apache acces
|
||||||
ufw deny 8080/tcp
|
ufw deny 8080/tcp
|
||||||
# Setup domain folder
|
# Setup domain folder
|
||||||
@@ -35,28 +37,32 @@ mysql -u root -p"$password" -e "SELECT user,authentication_string,plugin,host FR
|
|||||||
rm /etc/nginx/sites-enabled/default
|
rm /etc/nginx/sites-enabled/default
|
||||||
cat <<EOF > /etc/nginx/sites-available/"$domain"
|
cat <<EOF > /etc/nginx/sites-available/"$domain"
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
server_name $domain www.$domain;
|
||||||
|
root /var/www/$domain/html/;
|
||||||
|
index index.php index.htm index.html;
|
||||||
|
|
||||||
root /var/www/$domain/html;
|
location / {
|
||||||
index index.html index.htm index.php;
|
try_files \$uri \$uri/ /index.php;
|
||||||
|
}
|
||||||
|
|
||||||
server_name $domain www.$domain;
|
location ~ \.php\$ {
|
||||||
|
proxy_pass http://$server_ip:8080;
|
||||||
|
proxy_set_header Host \$host;
|
||||||
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
location ~ /\.ht {
|
||||||
try_files \$uri \$uri/ /index.php;
|
deny all;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ \.php\$ {
|
#listen 443 ssl;
|
||||||
proxy_redirect off;
|
#ssl_certificate /etc/letsencrypt/live/$domain/fullchain.pem;
|
||||||
proxy_set_header X-Real-IP \$remote_addr;
|
#ssl_certificate_key /etc/letsencrypt/live/$domain/privkey.pem;
|
||||||
proxy_set_header X-Forwarded-For \$remote_addr;
|
#include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||||
proxy_set_header Host \$host;
|
#ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||||
proxy_pass http://127.0.0.1:8080;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ /\.ht {
|
|
||||||
deny all;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/"$domain"
|
ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/"$domain"
|
||||||
|
|||||||
Reference in New Issue
Block a user