Bachir Soussi Chiadmi пре 6 година
родитељ
комит
0be97f397c
2 измењених фајлова са 22 додато и 6 уклоњено
  1. 13 0
      assets/index.php
  2. 9 6
      bin/vhost.sh

+ 13 - 0
assets/index.php

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+  <head>
+    <meta charset="utf-8">
+    <title>DOMAIN.LTD</title>
+  </head>
+  <body>
+    <h1>DOMAIN.LTD</h1>
+
+    <?php phpinfo(); ?>
+
+  </body>
+</html>

+ 9 - 6
bin/vhost.sh

@@ -90,25 +90,28 @@ if [ "$vh" = "y" ]; then
   sed -ir "s/DOMAIN\.LTD/$_domain/g" /etc/nginx/sites-available/"$_domain".conf
 
   mkdir -p /var/www/"$_domain"/public_html
-  mkdir /var/www/"$_domain"/logs
+  mkdir /var/www/"$_domain"/log
+
+  cp "$_assets/index.php" /var/www/"$_domain"/public_html/
+  sed -ir "s/DOMAIN\.LTD/$_domain/g" /var/www/"$_domain"/public_html/index.php
+
   #set proper right to user will handle the app
   chown -R root:admin  /var/www/"$_domain"/
   chmod -R g+w /var/www/"$_domain"/
   chmod -R g+r /var/www/"$_domain"/
 
-  # create a shortcut to the site
-  # TODO ask for $user name if not existing
 
+
+  # create a shortcut to the site
   echo -n "Should we install a shortcut for a user? [Y|n] "
   read yn
   yn=${yn:-y}
   if [ "$yn" = "y" ]; then
+    # if $user var does not exists (vhost.sh ran directly) ask for it
     if [ -z ${user+x} ]; then
-      echo -n "Enter an existing user name: "
-      read user
       while [ "$user" = "" ]
       do
-        read -p "enter a user name ? " user
+        read -p "enter an existing user name ? " user
         if [ "$user" != "" ]; then
           check if user already exists
           if id "$user" >/dev/null 2>&1; then