Просмотр исходного кода

Deprecate creating of public_shtml
Only when you can v-change-web-domain-sslhome user domain single folder will be recreated as it is required

Jaap Marcus 5 лет назад
Родитель
Сommit
5980cd1acd

+ 1 - 2
bin/v-add-web-domain

@@ -71,7 +71,6 @@ source $USER_DATA/user.conf
 # Creating domain directories
 $BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain"
 $BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain/public_html"
-$BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain/public_shtml"
 $BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain/document_errors"
 $BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain/cgi-bin"
 $BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain/private"
@@ -100,7 +99,7 @@ chmod 551 $HOMEDIR/$user/web/$domain/stats $HOMEDIR/$user/web/$domain/logs
 chmod 644 $HOMEDIR/$user/web/$domain/public_*html/*
 chown $user:www-data $HOMEDIR/$user/web/$domain/public_*html
 
-# Addding PHP-FPM backend
+# Adding PHP-FPM backend
 if [ ! -z "$WEB_BACKEND" ]; then
     if [ -z "$BACKEND_TEMPLATE" ]; then
         BACKEND_TEMPLATE='default'

+ 11 - 6
bin/v-change-web-domain-sslhome

@@ -64,6 +64,15 @@ case $SSL_HOME in
     *)      check_args '3' "2" 'USER DOMAIN SSLHOME'
 esac
 
+if [ "$SSL_HOME" = 'single' ] && [ ! -d $HOMEDIR/$user/web/$domain/public_shtml ]; then
+    mkdir $HOMEDIR/$user/web/$domain/public_shtml
+    chown $user:$user $HOMEDIR/$user/web/$domain/public_shtml
+    user_exec cp $WEBTPL/skel/public_html/* "$HOMEDIR/$user/web/$domain/public_shtml" >/dev/null 2>&1
+    for file in $(find "$HOMEDIR/$user/web/$domain/public_shtml" -type f); do
+        sed -i "s/%domain%/$domain/g" $file
+    done
+fi
+
 # Changing sslhome directory
 replace_web_config "$WEB_SYSTEM" "$TPL.stpl"
 
@@ -80,12 +89,8 @@ fi
 # Update config
 update_object_value 'web' 'DOMAIN' "$domain" '$SSL_HOME' "$SSL_HOME"
 
-# Restarting web server
-$BIN/v-restart-web $restart
-check_result $? "Web restart failed" >/dev/null
-
-$BIN/v-restart-proxy $restart
-check_result $? "Proxy restart failed" >/dev/null
+# Rebuild web
+$BIN/v-rebuild-web-domain $user $domain
 
 # Logging
 log_history "changed ssl home for $domain to $ssl_home"

+ 3 - 0
func/domain.sh

@@ -160,6 +160,9 @@ prepare_web_domain_values() {
     sdocroot="$docroot"
     if [ "$SSL_HOME" = 'single' ]; then
         sdocroot="$HOMEDIR/$user/web/$domain/public_shtml"
+        $BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain/public_shtml";
+        chmod 751 $HOMEDIR/$user/web/$domain/public_shtml;
+        chown www-data:$user $HOMEDIR/$user/web/$domain/public_shtml;    
     fi
 
     if [ ! -z "$WEB_BACKEND" ]; then

+ 3 - 8
func/rebuild.sh

@@ -216,7 +216,6 @@ rebuild_web_domain_conf() {
 
     $BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain"
     $BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain/public_html"
-    $BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain/public_shtml"
     $BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain/document_errors"
     $BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain/cgi-bin"
     $BIN/v-add-fs-directory "$user" "$HOMEDIR/$user/web/$domain/private"
@@ -248,8 +247,7 @@ rebuild_web_domain_conf() {
         $HOMEDIR/$user/web/$domain \
         $HOMEDIR/$user/web/$domain/private \
         $HOMEDIR/$user/web/$domain/cgi-bin \
-        $HOMEDIR/$user/web/$domain/public_html \
-        $HOMEDIR/$user/web/$domain/public_shtml
+        $HOMEDIR/$user/web/$domain/public_*html 
     chown -R $user:$user $HOMEDIR/$user/web/$domain/document_errors
     chown root:$user /var/log/$WEB_SYSTEM/domains/$domain.*
 
@@ -409,15 +407,12 @@ rebuild_web_domain_conf() {
                 $HOMEDIR/$user/web/$domain/logs
     chmod 751   $HOMEDIR/$user/web/$domain/private \
                 $HOMEDIR/$user/web/$domain/cgi-bin \
-                $HOMEDIR/$user/web/$domain/public_html \
-                $HOMEDIR/$user/web/$domain/public_shtml \
+                $HOMEDIR/$user/web/$domain/public_*html \
                 $HOMEDIR/$user/web/$domain/document_errors
     chmod 640 /var/log/$WEB_SYSTEM/domains/$domain.*
 
-    chown $user:www-data $HOMEDIR/$user/web/$domain/public_html \
-                $HOMEDIR/$user/web/$domain/public_shtml
+    chown $user:www-data $HOMEDIR/$user/web/$domain/public_*html
 }
-
 # DNS domain rebuild
 rebuild_dns_domain_conf() {
 

+ 0 - 113
install/deb/templates/web/skel/public_shtml/index.html

@@ -1,113 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="UTF-8">
-<meta name="viewport" content="width=device-width, initial-scale=1.0">
-<meta http-equiv="X-UA-Compatible" content="ie=edge">
-<title>Coming Soon</title>
-<style type="text/css">
-    body {
-        background-color: #f5f5f5;
-        margin-top: 8%;
-        color: #5d5d5d;
-        font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
-        text-shadow: 0px 1px 1px rgba(255,255,255,0.75);
-        text-align: center !important;
-    }
-
-    h1 {
-        font-size: 2.45em;
-        font-weight: 700;
-        color: #5d5d5d;
-        letter-spacing: -0.02em;
-        margin-bottom: 30px;
-        margin-top: 30px;
-    }
-
-    .container {
-        width: 100%;
-        margin-right: auto;
-        margin-left: auto;
-    }
-
-    .animated {
-        -webkit-animation-duration: 1s;
-        animation-duration: 1s;
-        -webkit-animation-fill-mode: both;
-        animation-fill-mode: both;
-    }
-
-    .fadeIn {
-        -webkit-animation-name: fadeIn;
-        animation-name: fadeIn;
-    }
-
-    .info {
-        color:#5594cf;
-        fill:#5594cf;
-    }
-
-    .error {
-        color:#c92127;
-        fill:#c92127;
-    }
-    
-    .warning {
-        color:#ffcc33;
-        fill:#ffcc33;
-    }
-
-    .success {
-        color:#5aba47;
-        fill:#5aba47;
-    }
-
-    .icon-large {
-        height: 132px;
-        width: 132px;
-    }
-
-    .description-text {
-        color: #707070;
-        letter-spacing: -0.01em;
-        font-size: 1.25em;
-        line-height: 20px;
-    }
-
-    .footer {
-        margin-top: 40px;
-        font-size: 0.7em;
-    }
-
-    .delay-1s {
-        -webkit-animation-delay: 1s;
-        animation-delay: 1s;
-    }
-
-    @keyframes fadeIn {
-        from { opacity: 0; }
-        to   { opacity: 1; }
-    }
-
-</style>
-</head>
-<body>
-<div class="container text-center">
-    <div class="row">
-        <div class="col">
-            <div class="animated fadeIn">
-                <svg class="warning icon-large fa-hard-hat" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
-                    <path d="M480 288c0-80.25-49.28-148.92-119.19-177.62L320 192V80a16 16 0 0 0-16-16h-96a16 16 0 0 0-16 16v112l-40.81-81.62C81.28 139.08 32 207.75 32 288v64h448zm16 96H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h480a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"></path>
-                </svg>
-            </div>
-            <h1 class="animated fadeIn">We're working on it!</h1>
-            <div class="description-text animated fadeIn delay-1s">
-                <p>This site is currently under construction.</p>
-                <p>Please check back soon.</p>
-                <section class="footer"><strong>Domain:</strong> %domain%</section>
-            </div>
-        </div>
-    </div>
-</div>
-</body>
-</html>

+ 0 - 3
install/deb/templates/web/skel/public_shtml/robots.txt

@@ -1,3 +0,0 @@
-# hestiacp autogenerated robots.txt
-User-agent: *
-Crawl-delay: 10