added default index.php

This commit is contained in:
Bachir Soussi Chiadmi 2018-04-07 16:06:11 +02:00
parent 29c8d50b53
commit 0be97f397c
2 changed files with 22 additions and 6 deletions

13
assets/index.php Normal file
View File

@ -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>

View File

@ -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