Przeglądaj źródła

Merge pull request #1109 from hestiacp/fix/1103-add_ssl_config_to_ip_conf

Fix/1103 add ssl config to ip conf
Raphael Schneeberger 5 lat temu
rodzic
commit
ec643201af

+ 1 - 0
bin/v-add-sys-ip

@@ -147,6 +147,7 @@ if [ ! -z "$PROXY_SYSTEM" ]; then
         sed -e "s/%ip%/$ip/g" \
             -e "s/%web_port%/$WEB_PORT/g" \
             -e "s/%proxy_port%/$PROXY_PORT/g" \
+            -e "s/%proxy_ssl_port%/$PROXY_SSL_PORT/g" \
         > /etc/$PROXY_SYSTEM/conf.d/$ip.conf
 
     # mod_extract_forwarded

+ 16 - 0
install/deb/templates/web/nginx/proxy_ip.tpl

@@ -12,3 +12,19 @@ server {
    }
 }
 
+server {
+    listen      %ip%:%proxy_ssl_port% ssl http2;
+    server_name _;
+    ssl_certificate      /usr/local/hestia/ssl/certificate.crt;
+    ssl_certificate_key  /usr/local/hestia/ssl/certificate.key;
+
+    return 301 http://$host$request_uri;
+
+    location / {
+        root /var/www/document_errors/;
+    }
+
+    location /error/ {
+        alias /var/www/document_errors/;
+    }
+}

+ 14 - 0
install/upgrade/versions/1.3.0.sh

@@ -5,3 +5,17 @@
 #######################################################################################
 #######                      Place additional commands below.                   #######
 #######################################################################################
+
+# Add default SSL Certificate config when ip is visited
+if [ "$PROXY_SYSTEM" = "nginx" ]; then
+    echo "[ ! ] Update IP.conf"
+    while read IP; do
+        rm /etc/nginx/conf.d/$IP.conf
+        cat $WEBTPL/$PROXY_SYSTEM/proxy_ip.tpl |\
+        sed -e "s/%ip%/$IP/g" \
+            -e "s/%web_port%/$WEB_PORT/g" \
+            -e "s/%proxy_port%/$PROXY_PORT/g" \
+            -e "s/%proxy_ssl_port%/$PROXY_SSL_PORT/g" \
+        > /etc/$PROXY_SYSTEM/conf.d/$IP.conf
+    done < <(ls $HESTIA/data/ips/)
+fi