Update 'RevProxySimple.sh'
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
# Pre-Config #
|
||||
##----------------##
|
||||
|
||||
# Set server IP variable for apache access
|
||||
server_ip=$(hostname -I|cut -f1 -d ' ')
|
||||
# Block direct apache acces
|
||||
ufw deny 8080/tcp
|
||||
# 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
|
||||
cat <<EOF > /etc/nginx/sites-available/"$domain"
|
||||
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;
|
||||
index index.html index.htm index.php;
|
||||
location / {
|
||||
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 / {
|
||||
try_files \$uri \$uri/ /index.php;
|
||||
}
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~ \.php\$ {
|
||||
proxy_redirect off;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$remote_addr;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
#listen 443 ssl;
|
||||
#ssl_certificate /etc/letsencrypt/live/$domain/fullchain.pem;
|
||||
#ssl_certificate_key /etc/letsencrypt/live/$domain/privkey.pem;
|
||||
#include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||
#ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||
}
|
||||
EOF
|
||||
ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/"$domain"
|
||||
|
||||
Reference in New Issue
Block a user