forked from docgonzo2015/SLEMP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_domain.sh
751 lines (699 loc) · 31.7 KB
/
add_domain.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
#!/bin/bash
# Copyright 2017-2018 Tim Scharner (https://timscha.io)
# Version 0.8.0
servicesCheck(){
ps cax | grep $1 > /dev/null
if [ $? -eq 0 ]; then
return 1
else
return 0
fi
}
source includes/install_web.sh
if [ -e /etc/redhat-release ]; then
DISTRO="centos"
elif [ -e /etc/debian_version ]; then
DISTRO="debian"
fi
if [ $DISTRO = "debian" ]; then
if [ -e /etc/apache2/apache2.conf ]; then
WEBSRV="apache"
WEBSRV_CONF_DIR="/etc/apache2/sites-available"
WEBSRV_SVC_NAME="apache2"
fi
elif [ $DISTRO = "centos" ]; then
if [ -e /etc/httpd/conf/httpd.conf ]; then
WEBSRV="apache"
WEBSRV_CONF_DIR="/etc/httpd/conf.d"
WEBSRV_SVC_NAME="httpd"
fi
fi
if [ -e /etc/nginx/nginx.conf ]; then
WEBSRV="nginx"
WEBSRV_CONF_DIR="/etc/nginx/conf.d"
fi
create_skeleton_dirs() {
useradd $HOST_LOCATION_USER -d /var/www/$USER_MAINDOMAIN
usermod -aG $HOST_LOCATION_USER $WEBSRV
if [ ! -d /var/www/$USER_MAINDOMAIN/htdocs ]; then
mkdir -p /var/www/$USER_MAINDOMAIN/htdocs
mkdir /var/www/$USER_MAINDOMAIN/logs
mkdir /var/www/$USER_MAINDOMAIN/tmp
fi
if [ $USER_DOMAIN_TYP = "1" ]; then
if [ ! -d /var/www/$USER_MAINDOMAIN/$USER_SUBDOMAIN ]; then
mkdir -p /var/www/$USER_MAINDOMAIN/$USER_SUBDOMAIN/htdocs
mkdir /var/www/$USER_MAINDOMAIN/$USER_SUBDOMAIN/logs
mkdir /var/www/$USER_MAINDOMAIN/$USER_SUBDOMAIN/tmp
fi
fi
chmod 755 /var/www/$USER_MAINDOMAIN
chmod 755 /var/www/$USER_MAINDOMAIN/$USER_SUBDOMAIN
chown -R $HOST_LOCATION_USER: /var/www/$USER_MAINDOMAIN
return 0
}
configure_fpm_pool(){
if [ $DISTRO = "debian" ]; then
if [ $USER_PHP_VERSION = "php73" ]; then
if [ $USER_DOMAIN_TYP = "0" ]; then
cp templates/phpfpmpool.template /etc/php/7.3/fpm/pool.d/$USER_MAINDOMAIN.conf
sed -i s/DOMAINNAME_HYPHEN/$USER_DOMAIN_HYPHEN/g /etc/php/7.3/fpm/pool.d/$USER_MAINDOMAIN.conf
sed -i s/HOST_LOCATION_USER/$HOST_LOCATION_USER/g /etc/php/7.3/fpm/pool.d/$USER_MAINDOMAIN.conf
sed -i 's|'HOST_DOMAIN_FULL'|'$HOST_MAINDOMAIN_ROOT_LOCATION'|g' /etc/php/7.3/fpm/pool.d/$USER_MAINDOMAIN.conf
sed -i s/PHP-SOCKET/php73-fpm-$USER_DOMAIN_HYPHEN/g /etc/php/7.3/fpm/pool.d/$USER_MAINDOMAIN.conf
fi
if [ $USER_DOMAIN_TYP = "1" ]; then
cp templates/phpfpmpool.template /etc/php/7.3/fpm/pool.d/$USER_SUBDOMAIN.conf
sed -i s/DOMAINNAME_HYPHEN/$USER_SUBDOMAIN_HYPHEN/g /etc/php/7.3/fpm/pool.d/$USER_SUBDOMAIN.conf
sed -i s/HOST_LOCATION_USER/$HOST_LOCATION_USER/g /etc/php/7.3/fpm/pool.d/$USER_SUBDOMAIN.conf
sed -i 's|'HOST_DOMAIN_FULL'|'$HOST_SUBDOMAIN_ROOT_LOCATION'|g' /etc/php/7.3/fpm/pool.d/$USER_SUBDOMAIN.conf
sed -i s/PHP-SOCKET/php73-fpm-$USER_SUBDOMAIN_HYPHEN/g /etc/php/7.3/fpm/pool.d/$USER_SUBDOMAIN.conf
fi
systemctl reload php7.3-fpm
fi
if [ $USER_PHP_VERSION = "php72" ]; then
if [ $USER_DOMAIN_TYP = "0" ]; then
cp templates/phpfpmpool.template /etc/php/7.2/fpm/pool.d/$USER_MAINDOMAIN.conf
sed -i s/DOMAINNAME_HYPHEN/$USER_DOMAIN_HYPHEN/g /etc/php/7.2/fpm/pool.d/$USER_MAINDOMAIN.conf
sed -i s/HOST_LOCATION_USER/$HOST_LOCATION_USER/g /etc/php/7.2/fpm/pool.d/$USER_MAINDOMAIN.conf
sed -i 's|'HOST_DOMAIN_FULL'|'$HOST_MAINDOMAIN_ROOT_LOCATION'|g' /etc/php/7.2/fpm/pool.d/$USER_MAINDOMAIN.conf
sed -i s/PHP-SOCKET/php72-fpm-$USER_DOMAIN_HYPHEN/g /etc/php/7.2/fpm/pool.d/$USER_MAINDOMAIN.conf
fi
if [ $USER_DOMAIN_TYP = "1" ]; then
cp templates/phpfpmpool.template /etc/php/7.2/fpm/pool.d/$USER_SUBDOMAIN.conf
sed -i s/DOMAINNAME_HYPHEN/$USER_SUBDOMAIN_HYPHEN/g /etc/php/7.2/fpm/pool.d/$USER_SUBDOMAIN.conf
sed -i s/HOST_LOCATION_USER/$HOST_LOCATION_USER/g /etc/php/7.2/fpm/pool.d/$USER_SUBDOMAIN.conf
sed -i 's|'HOST_DOMAIN_FULL'|'$HOST_SUBDOMAIN_ROOT_LOCATION'|g' /etc/php/7.2/fpm/pool.d/$USER_SUBDOMAIN.conf
sed -i s/PHP-SOCKET/php72-fpm-$USER_SUBDOMAIN_HYPHEN/g /etc/php/7.2/fpm/pool.d/$USER_SUBDOMAIN.conf
fi
systemctl reload php7.2-fpm
fi
if [ $USER_PHP_VERSION = "php71" ]; then
if [ $USER_DOMAIN_TYP = "0" ]; then
cp phpfpmpool.template /etc/php/7.1/fpm/pool.d/$USER_MAINDOMAIN.conf
sed -i s/DOMAINNAME_HYPHEN/$USER_DOMAIN_HYPHEN/g /etc/php/7.1/fpm/pool.d/$USER_MAINDOMAIN.conf
sed -i s/HOST_LOCATION_USER/$HOST_LOCATION_USER/g /etc/php/7.1/fpm/pool.d/$USER_MAINDOMAIN.conf
sed -i 's|'HOST_DOMAIN_FULL'|'$HOST_MAINDOMAIN_ROOT_LOCATION'|g' /etc/php/7.1/fpm/pool.d/$USER_MAINDOMAIN.conf
sed -i s/PHP-SOCKET/php71-fpm-$USER_DOMAIN_HYPHEN/g /etc/php/7.1/fpm/pool.d/$USER_MAINDOMAIN.conf
fi
if [ $USER_DOMAIN_TYP = "1" ]; then
cp phpfpmpool.template /etc/php/7.1/fpm/pool.d/$USER_SUBDOMAIN.conf
sed -i s/DOMAINNAME_HYPHEN/$USER_SUBDOMAIN_HYPHEN/g /etc/php/7.1/fpm/pool.d/$USER_SUBDOMAIN.conf
sed -i s/HOST_LOCATION_USER/$HOST_LOCATION_USER/g /etc/php/7.1/fpm/pool.d/$USER_SUBDOMAIN.conf
sed -i 's|'HOST_DOMAIN_FULL'|'$HOST_SUBDOMAIN_ROOT_LOCATION'|g' /etc/php/7.1/fpm/pool.d/$USER_SUBDOMAIN.conf
sed -i s/PHP-SOCKET/php71-fpm-$USER_SUBDOMAIN_HYPHEN/g /etc/php/7.1/fpm/pool.d/$USER_SUBDOMAIN.conf
fi
systemctl reload php7.1-fpm
fi
fi
if [ $DISTRO = "centos" ]; then
if [ $USER_PHP_VERSION = "php73" ]; then
if [ $USER_DOMAIN_TYP = "0" ]; then
cp templates/phpfpmpool.template /etc/opt/remi/php73/php-fpm.d/$USER_MAINDOMAIN.conf
sed -i s/DOMAINNAME_HYPHEN/$USER_DOMAIN_HYPHEN/g /etc/opt/remi/php73/php-fpm.d/$USER_MAINDOMAIN.conf
sed -i s/HOST_LOCATION_USER/$HOST_LOCATION_USER/g /etc/opt/remi/php73/php-fpm.d/$USER_MAINDOMAIN.conf
sed -i 's|'HOST_DOMAIN_FULL'|'$HOST_MAINDOMAIN_ROOT_LOCATION'|g' /etc/opt/remi/php73/php-fpm.d/$USER_MAINDOMAIN.conf
sed -i s/PHP-SOCKET/php73-fpm-$USER_DOMAIN_HYPHEN/g /etc/opt/remi/php73/php-fpm.d/$USER_MAINDOMAIN.conf
fi
if [ $USER_DOMAIN_TYP = "1" ]; then
cp templates/phpfpmpool.template /etc/opt/remi/php73/php-fpm.d/$USER_SUBDOMAIN.conf
sed -i s/DOMAINNAME_HYPHEN/$USER_SUBDOMAIN_HYPHEN/g /etc/opt/remi/php73/php-fpm.d/$USER_SUBDOMAIN.conf
sed -i s/HOST_LOCATION_USER/$HOST_LOCATION_USER/g /etc/opt/remi/php73/php-fpm.d/$USER_SUBDOMAIN.conf
sed -i 's|'HOST_DOMAIN_FULL'|'$HOST_SUBDOMAIN_ROOT_LOCATION'|g' /etc/opt/remi/php73/php-fpm.d/$USER_SUBDOMAIN.conf
sed -i s/PHP-SOCKET/php73-fpm-$USER_SUBDOMAIN_HYPHEN/g /etc/opt/remi/php73/php-fpm.d/$USER_SUBDOMAIN.conf
fi
systemctl reload php73-php-fpm
fi
if [ $USER_PHP_VERSION = "php72" ]; then
if [ $USER_DOMAIN_TYP = "0" ]; then
cp templates/phpfpmpool.template /etc/opt/remi/php72/php-fpm.d/$USER_MAINDOMAIN.conf
sed -i s/DOMAINNAME_HYPHEN/$USER_DOMAIN_HYPHEN/g /etc/opt/remi/php72/php-fpm.d/$USER_MAINDOMAIN.conf
sed -i s/HOST_LOCATION_USER/$HOST_LOCATION_USER/g /etc/opt/remi/php72/php-fpm.d/$USER_MAINDOMAIN.conf
sed -i 's|'HOST_DOMAIN_FULL'|'$HOST_MAINDOMAIN_ROOT_LOCATION'|g' /etc/opt/remi/php72/php-fpm.d/$USER_MAINDOMAIN.conf
sed -i s/PHP-SOCKET/php72-fpm-$USER_DOMAIN_HYPHEN/g /etc/opt/remi/php72/php-fpm.d/$USER_MAINDOMAIN.conf
fi
if [ $USER_DOMAIN_TYP = "1" ]; then
cp templates/phpfpmpool.template /etc/opt/remi/php72/php-fpm.d/$USER_SUBDOMAIN.conf
sed -i s/DOMAINNAME_HYPHEN/$USER_SUBDOMAIN_HYPHEN/g /etc/opt/remi/php72/php-fpm.d/$USER_SUBDOMAIN.conf
sed -i s/HOST_LOCATION_USER/$HOST_LOCATION_USER/g /etc/opt/remi/php72/php-fpm.d/$USER_SUBDOMAIN.conf
sed -i 's|'HOST_DOMAIN_FULL'|'$HOST_SUBDOMAIN_ROOT_LOCATION'|g' /etc/opt/remi/php72/php-fpm.d/$USER_SUBDOMAIN.conf
sed -i s/PHP-SOCKET/php72-fpm-$USER_SUBDOMAIN_HYPHEN/g /etc/opt/remi/php72/php-fpm.d/$USER_MAINDOMAIN.conf
fi
systemctl reload php72-php-fpm
fi
if [ $USER_PHP_VERSION = "php71" ]; then
if [ $USER_DOMAIN_TYP = "0" ]; then
cp templates/phpfpmpool.template /etc/opt/remi/php71/php-fpm.d/$USER_MAINDOMAIN.conf
sed -i s/DOMAINNAME_HYPHEN/$USER_DOMAIN_HYPHEN/g /etc/opt/remi/php71/php-fpm.d/$USER_MAINDOMAIN.conf
sed -i s/HOST_LOCATION_USER/$HOST_LOCATION_USER/g /etc/opt/remi/php71/php-fpm.d/$USER_MAINDOMAIN.conf
sed -i 's|'HOST_DOMAIN_FULL'|'$HOST_MAINDOMAIN_ROOT_LOCATION'|g' /etc/opt/remi/php71/php-fpm.d/$USER_MAINDOMAIN.conf
sed -i s/PHP-SOCKET/php71-fpm-$USER_DOMAIN_HYPHEN/g /etc/opt/remi/php71/php-fpm.d/$USER_MAINDOMAIN.conf
fi
if [ $USER_DOMAIN_TYP = "1" ]; then
cp templates/phpfpmpool.template /etc/opt/remi/php71/php-fpm.d/$USER_SUBDOMAIN.conf
sed -i s/DOMAINNAME_HYPHEN/$USER_SUBDOMAIN_HYPHEN/g /etc/opt/remi/php71/php-fpm.d/$USER_SUBDOMAIN.conf
sed -i s/HOST_LOCATION_USER/$HOST_LOCATION_USER/g /etc/opt/remi/php71/php-fpm.d/$USER_SUBDOMAIN.conf
sed -i 's|'HOST_DOMAIN_FULL'|'$HOST_SUBDOMAIN_ROOT_LOCATION'|g' /etc/opt/remi/php71/php-fpm.d/$USER_SUBDOMAIN.conf
sed -i s/PHP-SOCKET/php71-fpm-$USER_SUBDOMAIN_HYPHEN/g /etc/opt/remi/php71/php-fpm.d/$USER_MAINDOMAIN.conf
fi
systemctl -q reload php71-php-fpm
fi
fi
return 0
}
configure_apache_vhost() {
if [ $USER_DOMAIN_TYP = "0" ]; then
if [ $USER_PHP_VERSION = "php73" ]; then
NGXSOCKET="/var/run/php73-fpm-$USER_DOMAIN_HYPHEN.sock"
fi
if [ $USER_PHP_VERSION = "php72" ]; then
NGXSOCKET="/var/run/php72-fpm-$USER_DOMAIN_HYPHEN.sock"
fi
if [ $USER_PHP_VERSION = "php71" ]; then
NGXSOCKET="/var/run/php71-fpm-$USER_DOMAIN_HYPHEN.sock"
fi
if [ $DISTRO = "debian" ]; then
if [ $USER_CMS_CHOICE = "none" ]; then
cp templates/apache_default.template /etc/apache2/sites-available/$USER_MAINDOMAIN.conf
fi
if [ $USER_CMS_CHOICE = "nextcloud" ]; then
cp templates/apache_nextcloud.template /etc/apache2/sites-available/$USER_MAINDOMAIN.conf
fi
if [ $USER_CMS_CHOICE = "wordpress" ]; then
cp templates/apache_wordpress.template /etc/apache2/sites-available/$USER_MAINDOMAIN.conf
fi
sed -i s/DOMAIN_HYPHEN/$USER_DOMAIN_HYPHEN/g /etc/apache2/sites-available/$USER_MAINDOMAIN.conf
sed -i 's|'NGXSOCKET'|'$NGXSOCKET'|g' /etc/apache2/sites-available/$USER_MAINDOMAIN.conf
sed -i s/#Protocols/Protocols/g /etc/apache2/sites-available/$USER_MAINDOMAIN.conf
sed -i s/#SSLSessionTickets/SSLSessionTickets/g /etc/apache2/sites-available/$USER_MAINDOMAIN.conf
sed -i s/DOMAIN_FULLNAME/$USER_MAINDOMAIN/g /etc/apache2/sites-available/$USER_MAINDOMAIN.conf
sed -i s/SSL_DOMAINNAME_FULLNAME/$USER_MAINDOMAIN/g /etc/apache2/sites-available/$USER_MAINDOMAIN.conf
sed -i 's|'HOST_HTTPD_LOCATION'|'$HOST_MAINDOMAIN_HTTPD_LOCATION'|g' /etc/apache2/sites-available/$USER_MAINDOMAIN.conf
sed -i 's|'HOST_ROOT_LOCATION'|'$HOST_MAINDOMAIN_ROOT_LOCATION'|g' /etc/apache2/sites-available/$USER_MAINDOMAIN.conf
a2ensite -q $USER_MAINDOMAIN.conf
fi
if [ $DISTRO = "centos" ]; then
if [ $USER_CMS_CHOICE = "none" ]; then
cp templates/apache_default.template /etc/httpd/conf.d/$USER_MAINDOMAIN.conf
fi
if [ $USER_CMS_CHOICE = "nextcloud" ]; then
cp templates/apache_nextcloud.template /etc/httpd/conf.d/$USER_MAINDOMAIN.conf
fi
if [ $USER_CMS_CHOICE = "wordpress" ]; then
cp templates/apache_wordpress.template /etc/httpd/conf.d/$USER_MAINDOMAIN.conf
fi
sed -i s/DOMAIN_HYPHEN/$USER_DOMAIN_HYPHEN/g /etc/httpd/conf.d/$USER_MAINDOMAIN.conf
sed -i 's|'NGXSOCKET'|'$NGXSOCKET'|g' /etc/httpd/conf.d/$USER_MAINDOMAIN.conf
sed -i s/DOMAIN_FULLNAME/$USER_MAINDOMAIN/g /etc/httpd/conf.d/$USER_MAINDOMAIN.conf
sed -i s/SSL_DOMAINNAME_FULLNAME/$USER_MAINDOMAIN/g /etc/httpd/conf.d/$USER_MAINDOMAIN.conf
sed -i 's|'HOST_HTTPD_LOCATION'|'$HOST_MAINDOMAIN_HTTPD_LOCATION'|g' /etc/httpd/conf.d/$USER_MAINDOMAIN.conf
sed -i 's|'HOST_ROOT_LOCATION'|'$HOST_MAINDOMAIN_ROOT_LOCATION'|g' /etc/httpd/conf.d/$USER_MAINDOMAIN.conf
systemctl -q reload httpd
fi
fi
if [ $USER_DOMAIN_TYP = "1" ]; then
if [ $USER_PHP_VERSION = "php73" ]; then
NGXSOCKET="/var/run/php73-fpm-$USER_SUBDOMAIN_HYPHEN.sock"
fi
if [ $USER_PHP_VERSION = "php72" ]; then
NGXSOCKET="/var/run/php72-fpm-$USER_SUBDOMAIN_HYPHEN.sock"
fi
if [ $USER_PHP_VERSION = "php71" ]; then
NGXSOCKET="/var/run/php71-fpm-$USER_SUBDOMAIN_HYPHEN.sock"
fi
if [ $DISTRO = "debian" ]; then
if [ $USER_CMS_CHOICE = "none" ]; then
cp templates/apache_default.template /etc/apache2/sites-available/$USER_SUBDOMAIN.conf
fi
if [ $USER_CMS_CHOICE = "nextcloud" ]; then
cp templates/apache_nextcloud.template /etc/apache2/sites-available/$USER_SUBDOMAIN.conf
fi
if [ $USER_CMS_CHOICE = "wordpress" ]; then
cp templates/apache_default.template /etc/apache2/sites-available/$USER_SUBDOMAIN.conf
fi
sed -i s/DOMAIN_HYPHEN/$USER_SUBDOMAIN_HYPHEN/g /etc/apache2/sites-available/$USER_SUBDOMAIN.conf
sed -i 's|'NGXSOCKET'|'$NGXSOCKET'|g' /etc/apache2/sites-available/$USER_SUBDOMAIN.conf
sed -i s/#Protocols/Protocols/g /etc/apache2/sites-available/$USER_SUBDOMAIN.conf
sed -i s/#SSLSessionTickets/SSLSessionTickets/g /etc/apache2/sites-available/$USER_SUBDOMAIN.conf
sed -i s/DOMAIN_FULLNAME/$USER_SUBDOMAIN/g /etc/apache2/sites-available/$USER_SUBDOMAIN.conf
sed -i s/SSL_DOMAINNAME_FULLNAME/$USER_SUBDOMAIN/g /etc/apache2/sites-available/$USER_SUBDOMAIN.conf
sed -i 's|'HOST_HTTPD_LOCATION'|'$HOST_SUBDOMAIN_ROOT_LOCATION'|g' /etc/apache2/sites-available/$USER_SUBDOMAIN.conf
sed -i 's|'HOST_ROOT_LOCATION'|'$HOST_SUBDOMAIN_ROOT_LOCATION'|g' /etc/apache2/sites-available/$USER_SUBDOMAIN.conf
a2ensite -q $USER_SUBDOMAIN.conf
fi
if [ $DISTRO = "centos" ]; then
if [ $USER_CMS_CHOICE = "none" ]; then
cp templates/apache_default.template /etc/httpd/conf.d/$USER_SUBDOMAIN.conf
fi
if [ $USER_CMS_CHOICE = "nextcloud" ]; then
cp templates/apache_nextcloud.template /etc/httpd/conf.d/$USER_SUBDOMAIN.conf
fi
if [ $USER_CMS_CHOICE = "wordpress" ]; then
cp templates/apache_default.template /etc/httpd/conf.d/$USER_SUBDOMAIN.conf
fi
sed -i s/DOMAIN_HYPHEN/$USER_SUBDOMAIN_HYPHEN/g /etc/httpd/conf.d/$USER_SUBDOMAIN.conf
sed -i 's|'NGXSOCKET'|'$NGXSOCKET'|g' /etc/httpd/conf.d/$USER_SUBDOMAIN.conf
sed -i s/DOMAIN_FULLNAME/$USER_SUBDOMAIN/g /etc/httpd/conf.d/$USER_SUBDOMAIN.conf
sed -i s/SSL_DOMAINNAME_FULLNAME/$USER_SUBDOMAIN/g /etc/httpd/conf.d/$USER_SUBDOMAIN.conf
sed -i 's|'HOST_HTTPD_LOCATION'|'$HOST_SUBDOMAIN_ROOT_LOCATION'|g' /etc/httpd/conf.d/$USER_SUBDOMAIN.conf
sed -i 's|'HOST_ROOT_LOCATION'|'$HOST_SUBDOMAIN_ROOT_LOCATION'|g' /etc/httpd/conf.d/$USER_SUBDOMAIN.conf
systemctl -q reload httpd
fi
fi
if [ $USER_DOMAIN_TYP = "2" ]; then
if [ $USER_DOMAIN_REDIRECT_TYP = "0" ]; then
sed -i 's/\<ServerAlias\>/& $USER_REDIRECT_SOURCE_DOMAIN/' $WEBSRV_CONF_DIR/$USER_REDIRECT_TARGET_DOMAIN.conf
if [ $DISTRO = "centos" ]; then
systemctl -q reload httpd
fi
if [ $DISTRO = "debian" ]; then
a2ensite -q $USER_REDIRECT_TARGET_DOMAIN.conf
systemctl -q reload apache2
fi
elif [ $USER_DOMAIN_REDIRECT_TYP = "1" ]; then
cp templates/apache_redirect.template $WEBSRV_CONF_DIR/$USER_REDIRECT_SOURCE_DOMAIN.conf
sed -i s/DOMAIN_FULLNAME/$USER_REDIRECT_SOURCE_DOMAIN/g $WEBSRV_CONF_DIR/$USER_REDIRECT_SOURCE_DOMAIN.conf
sed -i 's|'TARGET_DOMAINNAME'|'$USER_REDIRECT_TARGET_DOMAIN'|g' $WEBSRV_CONF_DIR/$USER_REDIRECT_SOURCE_DOMAIN.conf
sed -i s/SSL_DOMAINNAME_FULLNAME/$USER_REDIRECT_SOURCE_DOMAIN/g $WEBSRV_CONF_DIR/$USER_REDIRECT_SOURCE_DOMAIN.conf
if [ $DISTRO = "centos" ]; then
systemctl -q reload httpd
fi
if [ $DISTRO = "debian" ]; then
a2ensite -q $USER_REDIRECT_SOURCE_DOMAIN.conf
systemctl -q reload apache2
fi
fi
fi
return 0
}
configure_nginx_vhost(){
if [ $USER_DOMAIN_TYP = "0" ]; then
if [ $USER_PHP_VERSION = "php73" ]; then
NGXSOCKET="/var/run/php73-fpm-$USER_DOMAIN_HYPHEN.sock;"
elif [ $USER_PHP_VERSION = "php72" ]; then
NGXSOCKET="/var/run/php72-fpm-$USER_DOMAIN_HYPHEN.sock;"
elif [ $USER_PHP_VERSION = "php71" ]; then
NGXSOCKET="/var/run/php71-fpm-$USER_DOMAIN_HYPHEN.sock;"
elif [ $USER_CMS_CHOICE = "none" ]; then
cp templates/nginx_default.template /etc/nginx/conf.d/$USER_MAINDOMAIN.conf
elif [ $USER_CMS_CHOICE = "nextcloud" ]; then
cp templates/nginx_nextcloud.template /etc/nginx/conf.d/$USER_MAINDOMAIN.conf
elif [ $USER_CMS_CHOICE = "wordpress" ]; then
cp templates/nginx_wordpress.template /etc/nginx/conf.d/$USER_MAINDOMAIN.conf
fi
sed -i s/DOMAIN_HYPHEN/$USER_DOMAIN_HYPHEN/g /etc/nginx/conf.d/$USER_MAINDOMAIN.conf
sed -i 's|'NGXSOCKET'|'$NGXSOCKET'|g' /etc/nginx/conf.d/$USER_MAINDOMAIN.conf
sed -i s/DOMAIN_FULLNAME/$USER_MAINDOMAIN/g /etc/nginx/conf.d/$USER_MAINDOMAIN.conf
sed -i s/SSL_DOMAINNAME_FULLNAME/$USER_MAINDOMAIN/g /etc/nginx/conf.d/$USER_MAINDOMAIN.conf
sed -i 's|'DOMAIN_HTTPD_LOCATION'|'$HOST_MAINDOMAIN_HTTPD_LOCATION'|g' /etc/nginx/conf.d/$USER_MAINDOMAIN.conf
sed -i 's|'HOST_ROOT_LOCATION'|'$HOST_MAINDOMAIN_ROOT_LOCATION'|g' /etc/nginx/conf.d/$USER_MAINDOMAIN.conf
elif [ $USER_DOMAIN_TYP = "1" ]; then
if [ $USER_PHP_VERSION = "php73" ]; then
NGXSOCKET="/var/run/php73-fpm-$USER_SUBDOMAIN_HYPHEN.sock;"
elif [ $USER_PHP_VERSION = "php72" ]; then
NGXSOCKET="/var/run/php72-fpm-$USER_SUBDOMAIN_HYPHEN.sock;"
elif [ $USER_PHP_VERSION = "php71" ]; then
NGXSOCKET="/var/run/php71-fpm-$USER_SUBDOMAIN_HYPHEN.sock;"
elif [ $USER_CMS_CHOICE = "none" ]; then
cp templates/nginx_default.template /etc/nginx/conf.d/$USER_SUBDOMAIN.conf
elif [ $USER_CMS_CHOICE = "nextcloud" ]; then
cp templates/nginx_nextcloud.template /etc/nginx/conf.d/$USER_SUBDOMAIN.conf
elif [ $USER_CMS_CHOICE = "wordpress" ]; then
cp templates/nginx_wordpress.template /etc/nginx/conf.d/$USER_SUBDOMAIN.conf
fi
sed -i s/DOMAIN_HYPHEN/$USER_SUBDOMAIN_HYPHEN/g /etc/nginx/conf.d/$USER_SUBDOMAIN.conf
sed -i 's|'NGXSOCKET'|'$NGXSOCKET'|g' /etc/nginx/conf.d/$USER_SUBDOMAIN.conf
sed -i s/DOMAIN_FULLNAME/$USER_SUBDOMAIN/g /etc/nginx/conf.d/$USER_SUBDOMAIN.conf
sed -i s/SSL_DOMAINNAME_FULLNAME/$USER_SUBDOMAIN/g /etc/nginx/conf.d/$USER_SUBDOMAIN.conf
sed -i 's|'DOMAIN_HTTPD_LOCATION'|'$HOST_SUBDOMAIN_HTTPD_LOCATION'|g' /etc/nginx/conf.d/$USER_SUBDOMAIN.conf
sed -i 's|'HOST_ROOT_LOCATION'|'$HOST_SUBDOMAIN_ROOT_LOCATION'|g' /etc/nginx/conf.d/$USER_SUBDOMAIN.conf
elif [ $USER_DOMAIN_TYP = "2" ]; then
if [ $USER_DOMAIN_REDIRECT_TYP = "0" ]; then
sed -i '/server_name /s/;/ $USER_REDIRECT_SOURCE_DOMAIN;/' /etc/nginx/conf.d/$USER_REDIRECT_TARGET_DOMAIN.conf
elif [ $USER_DOMAIN_REDIRECT_TYP = "1" ]; then
cp templates/nginx_redirect.template /etc/nginx/conf.d/$USER_REDIRECT_SOURCE_DOMAIN.conf
sed -i s/DOMAIN_FULLNAME/$USER_REDIRECT_SOURCE_DOMAIN/g /etc/nginx/conf.d/$USER_REDIRECT_SOURCE_DOMAIN.conf
sed -i 's|'TARGET_DOMAINNAME'|'$USER_REDIRECT_TARGET_DOMAIN'|g' /etc/nginx/conf.d/$USER_REDIRECT_SOURCE_DOMAIN.conf
sed -i s/SSL_DOMAINNAME_FULLNAME/$USER_REDIRECT_SOURCE_DOMAIN/g /etc/nginx/conf.d/$USER_REDIRECT_SOURCE_DOMAIN.conf
fi
fi
return 0
}
configure_logrotate() {
if [ $WEBSRV = "nginx" ]; then
if [ $USER_DOMAIN_TYP = "0" ]; then
cat >> /etc/logrotate.d/nginx <<EOL
/var/log/www/$USER_MAINDOMAIN/logs/*.log {
daily
copytruncate
missingok
notifempty
compress
delaycompress
postrotate
if [ -f /var/run/nginx.pid ]; then
kill -USR1 `cat /var/run/nginx.pid`
fi
endscript
}
EOL
elif [ $USER_DOMAIN_TYP = "1" ]; then
cat >> /etc/logrotate.d/nginx <<EOL
/var/log/www/$USER_MAINDOMAIN/$USER_SUBDOMAIN/logs/*.log {
daily
copytruncate
missingok
notifempty
compress
delaycompress
postrotate
if [ -f /var/run/nginx.pid ]; then
kill -USR1 `cat /var/run/nginx.pid`
fi
endscript
}
EOL
fi
elif [ $DISTRO = "centos" ]; then
if [ $WEBSRV = "apache" ]; then
cat >> /etc/logrotate.d/httpd <<EOL
$HOST_ROOT_LOCATION/logs/*.log {
daily
missingok
notifempty
sharedscripts
delaycompress
postrotate
/bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
endscript
}
EOL
fi
elif [ $DISTRO = "debian" ]; then
if [ $WEBSRV = "apache" ]; then
cat >> /etc/logrotate.d/apache2 <<EOL
$HOST_ROOT_LOCATION/logs/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
if /etc/init.d/apache2 status > /dev/null ; then \
/etc/init.d/apache2 reload > /dev/null; \
fi;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
}
EOL
fi
fi
return 0
}
configure_letsencrypt() {
# Redirect Typ 0 = Alias / Redirect Typ 1 = Redirect
if [ $WEBSRV = "nginx" ]; then
if [ $USER_DOMAIN_TYP = "0" ]; then
certbot certonly --standalone --agree-tos --email hostmaster@$USER_MAINDOMAIN --non-interactive --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" --rsa-key-size 4096 -d $USER_MAINDOMAIN -d www.$USER_MAINDOMAIN
return 0
elif [ $USER_DOMAIN_TYP = "1" ]; then
certbot certonly --standalone --agree-tos --email hostmaster@$USER_MAINDOMAIN --non-interactive --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" --rsa-key-size 4096 -d $USER_MAINDOMAIN -d www.$USER_MAINDOMAIN -d $USER_SUBDOMAIN
return 0
elif [ $USER_DOMAIN_TYP = "2" ] && [ $USER_DOMAIN_REDIRECT_TYP = "0" ] ; then
# First we are looking for the row with the servernames, then we are looking for all entries until the end of the row. SED remove the ; and add -d
LE_EXISTING_DOMAINNAMES=grep 'server_name ' $WEBSRV_CONF_DIR/$USER_MAINDOMAIN -m 1 | awk '{for (i=1;i<=1;i++){$i=""};print}' | sed 's/;//g' | sed 's/ / -d /g'
certbot certonly --standalone --expand --agree-tos --email hostmaster@$USER_EXISTING_DOMAIN --non-interactive --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" --rsa-key-size 4096 -d $USER_REDIRECT_SOURCE_DOMAIN $LE_EXISTING_DOMAINNAMES
return 0
elif [ $USER_DOMAIN_TYP = "2" ] && [ $USER_DOMAIN_REDIRECT_TYP = "1" ] ; then
certbot certonly --standalone --agree-tos --email hostmaster@$USER_REDIRECT_SOURCE_DOMAIN --non-interactive --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" --rsa-key-size 4096 -d $USER_REDIRECT_SOURCE_DOMAIN
return 0
fi
fi
if [ $WEBSRV = "apache" ]; then
if [ $USER_DOMAIN_TYP = "0" ]; then
certbot certonly --standalone --agree-tos --email hostmaster@$USER_MAINDOMAIN --non-interactive --pre-hook "systemctl stop $WEBSRV_SVC_NAME" --post-hook "systemctl start $WEBSRV_SVC_NAME" --rsa-key-size 4096 -d $USER_MAINDOMAIN -d www.$USER_MAINDOMAIN
return 0
elif [ $USER_DOMAIN_TYP = "1" ]; then
certbot certonly --standalone --agree-tos --email hostmaster@$USER_MAINDOMAIN --non-interactive --pre-hook "systemctl stop $WEBSRV_SVC_NAME" --post-hook "systemctl start $WEBSRV_SVC_NAME" --rsa-key-size 4096 -d $USER_MAINDOMAIN -d www.$USER_MAINDOMAIN -d $USER_SUBDOMAIN
return 0
elif [ $USER_DOMAIN_TYP = "2" ] && [ $USER_DOMAIN_REDIRECT_TYP = "0" ]; then
LE_EXISTING_DOMAINNAMES=grep 'ServerAlias' $WEBSRV_CONF_DIR/$USER_MAINDOMAIN -m 1 | awk '{for (i=1;i<=1;i++){$i=""};print}' | sed 's/ / -d /g'
certbot certonly --standalone --expand --agree-tos --email hostmaster@$USER_EXISTING_DOMAIN --non-interactive --pre-hook "systemctl stop $WEBSRV_SVC_NAME" --post-hook "systemctl start $WEBSRV_SVC_NAME" --rsa-key-size 4096 -d $USER_REDIRECT_SOURCE_DOMAIN $LE_EXISTING_DOMAINNAMES
return 0
elif [ $USER_DOMAIN_TYP = "2" ] && [ $USER_DOMAIN_REDIRECT_TYP = "1" ]; then
certbot certonly --standalone --agree-tos --email hostmaster@$USER_REDIRECT_SOURCE_DOMAIN --non-interactive --pre-hook "systemctl stop $WEBSRV_SVC_NAME" --post-hook "systemctl start $WEBSRV_SVC_NAME" --rsa-key-size 4096 -d $USER_REDIRECT_SOURCE_DOMAIN
return 0
fi
fi
return 0
}
configure_database(){
echo <<EOFMW "
#################################################################
#
# We will now create the mysql database called '$HOST_DB_DATABASE',
# and also setup a mysql database user '$HOST_DB_USER'.
#
# Warning: if the database exists it will be dropped, if the user
# exists the password will be reset. (Ctrl-c to abort)
#
# Please provide your mysql root password if required
#################################################################
"
EOFMW
mysql -f -u root -p$MYSQL_ROOT_PASS -e <<EOSQL "DROP DATABASE IF EXISTS $HOST_DB_DATABASE ;
CREATE DATABASE $HOST_DB_DATABASE;
GRANT ALL PRIVILEGES ON $HOST_DB_DATABASE.* TO '$HOST_DB_USER'@'localhost' IDENTIFIED BY '$HOST_DB_PASS';
FLUSH PRIVILEGES;"
EOSQL
}
echo <<EOF "
#################################################################
#
# $(basename $0) will attempt to add a vhost to your system now.
# This script is provided as it is, no warraties implied. (Ctrl-c to abort)
#
# Be sure that your domain have the following DNS configuration:
#
# If you use a domain:
#
# @ 3600 IN A YOUR_SERVER_IP
# www.example.com. 3600 IN A YOUR_SERVER_IP
#
# If you use a subdomain:
#
# yoursubdomain.example.com. 3600 IN A YOUR_SERVER_IP
#
# If the dns setup is not correct, the setup will fail.
#
#################################################################
"
EOF
read -p "Do you want to add the vhost? y/n " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
clear
PS3='Do you want to add a domain, subdomain or alias/redirect? '
options=("Domain" "Subdomain" "Alias/Redirect")
select opt in "${options[@]}"
do
case $opt in
"Domain")
echo "Domain selected"
USER_DOMAIN_TYP=0
break
;;
"Subdomain")
echo "Subdomain selected"
USER_DOMAIN_TYP=1
break
;;
"Alias/Redirect")
echo "Alias/Redirect selected"
USER_DOMAIN_TYP=2
break
;;
*) echo invalid option;;
esac
done
if [ $USER_DOMAIN_TYP -ne "2" ]; then
read -p 'Domain [example.com]: ' USER_MAINDOMAIN
if [ $USER_DOMAIN_TYP = "1" ]; then
read -p 'Subdomain [subdomain.example.com]: ' USER_SUBDOMAIN
fi
PS3='Select the PHP for your domain: '
options=("PHP 7.1" "PHP 7.2" "PHP 7.3")
select opt in "${options[@]}"
do
case $opt in
"PHP 7.1")
echo "PHP 7.1 selected"
USER_PHP_VERSION=php71
break
;;
"PHP 7.2")
echo "PHP 7.2 selected"
USER_PHP_VERSION=php72
break
;;
"PHP 7.3")
echo "PHP 7.3 selected"
USER_PHP_VERSION=php73
break
;;
*) echo invalid option;;
esac
done
PS3='Select an Installer for your domain: '
options=("Nextcloud" "Wordpress" "None")
select opt in "${options[@]}"
do
case $opt in
"Nextcloud")
echo "Nextcloud selected"
USER_CMS_CHOICE=nextcloud
break
;;
"Wordpress")
echo "Wordpress selected"
USER_CMS_CHOICE=wordpress
break
;;
"None")
USER_CMS_CHOICE=none
break
;;
*) echo invalid option;;
esac
done
if [ $USER_CMS_CHOICE = "nextcloud" ] || [ $USER_CMS_CHOICE = "wordpress" ]; then
USER_DB_SITE=1
else
read -p "Do you want to add a database? [y/n] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
printf "\nPlease provide your MySQL-Root-Password when asked.\n"
USER_DB_SITE=1
else
USER_DB_SITE=0
fi
fi
HOST_LOCATION_USER=(${USER_MAINDOMAIN//./ })
HOST_DB_ADDITION=$(</dev/urandom tr -dc A-Za-z0-9 | head -c4)
if [ $USER_DOMAIN_TYP = "0" ]; then
HOST_DB_USER=$HOST_LOCATION_USER'_usr_'$HOST_DB_ADDITION
elif [ $USER_DOMAIN_TYP = "1" ]; then
HOST_DB_USER=$HOST_LOCATION_USER'_usr_'$HOST_DB_ADDITION
fi
if [ $USER_DOMAIN_TYP = "0" ]; then
HOST_DB_DATABASE=${USER_MAINDOMAIN//./_}
elif [ $USER_DOMAIN_TYP = "1" ]; then
HOST_DB_DATABASE=${USER_SUBDOMAIN//./_}
fi
HOST_DB_PASS=$(</dev/urandom tr -dc A-Za-z0-9 | head -c10)
USER_DOMAIN_HYPHEN=${USER_MAINDOMAIN/./-}
USER_SUBDOMAIN_HYPHEN=${USER_SUBDOMAIN//./-}
HOST_MAINDOMAIN_ROOT_LOCATION="/var/www/$USER_MAINDOMAIN"
HOST_SUBDOMAIN_ROOT_LOCATION="/var/www/$USER_MAINDOMAIN/$USER_SUBDOMAIN"
HOST_MAINDOMAIN_HTTPD_LOCATION="/var/www/$USER_MAINDOMAIN/htdocs"
HOST_SUBDOMAIN_HTTPD_LOCATION="/var/www/$USER_MAINDOMAIN/$USER_SUBDOMAIN/htdocs"
create_skeleton_dirs
configure_fpm_pool
if [ $WEBSRV = "nginx" ]; then
configure_nginx_vhost
elif [ $WEBSRV = "apache" ]; then
configure_apache_vhost
fi
configure_logrotate
configure_letsencrypt
if [ $USER_DB_SITE = "1" ]; then
configure_database
fi
if [ $USER_CMS_CHOICE = "nextcloud" ]; then
configure_nextcloud
elif [ $USER_CMS_CHOICE = "wordpress" ]; then
configure_wordpress
fi
[ $? -ne "0" ] && exit 1
fi # if [ $USER_DOMAIN_TYP -ne "2" ]; then
if [ $USER_DOMAIN_TYP = "2" ]; then
clear
PS3='Select the domain forwarding typ: '
options=("Alias" "Redirect")
select opt in "${options[@]}"
do
case $opt in
"Alias")
echo "Alias selected"
USER_DOMAIN_REDIRECT_TYP=0
break
;;
"Redirect")
echo "Redirect selected"
USER_DOMAIN_REDIRECT_TYP=1
break
;;
*) echo invalid option;;
esac
done
if [ $USER_DOMAIN_REDIRECT_TYP = "0" ]; then
read -p 'Enter the target domain on this server: ' USER_EXISTING_DOMAIN
USER_REDIRECT_TARGET_DOMAIN=(${USER_REDIRECT_TARGET_DOMAIN//./ })
if [ -e $WEBSRV_CONF_DIR/$USER_REDIRECT_TARGET_DOMAIN.conf ]; then
read -p 'Alias domain which should be added: ' USER_ALIAS_DOMAIN
configure_letsencrypt
else
echo "Domain not exists on the server. Exit."
exit 2
fi
elif [ $USER_DOMAIN_REDIRECT_TYP = "1" ]; then
read -p 'Source Domain [(subdomain.)example.com]: ' USER_REDIRECT_SOURCE_DOMAIN
echo
read -p 'Target Domain [(subdomain.)example.com]: ' USER_REDIRECT_TARGET_DOMAIN
echo
configure_letsencrypt
if [ $WEBSRV = "nginx" ]; then
configure_nginx_vhost
elif [ $WEBSRV = "apache" ]; then
configure_apache_vhost
fi # if [ $WEBSRV = "nginx" ]; then
fi # elif [ $USER_DOMAIN_REDIRECT_TYP = "1"]; then
fi # if [ $USER_DOMAIN_TYP = "2"]; then
fi # if [[ $REPLY =~ ^[Yy]$ ]]
echo <<EOF "
#################################################################
#
# Your domain is ready to use:
#
"
EOF
echo "Domain: $USER_MAINDOMAIN"
if [ $USER_DOMAIN_TYP = "1" ]; then
echo "Subdomain: $USER_SUBDOMAIN"
fi
echo "Absolute path domain: $HOST_MAINDOMAIN_ROOT_LOCATION"
if [ $USER_DOMAIN_TYP = "1" ]; then
echo "Absolute path subdomain: $HOST_SUBDOMAIN_ROOT_LOCATION"
fi
echo "Location owner: $HOST_LOCATION_USER"
if [ "$USER_DB_SITE" = "1" ]; then
echo "MySQL username: $HOST_DB_USER"
echo "MySQL password: $HOST_DB_PASS"
echo "MySQL database: $HOST_DB_DATABASE"
fi
echo <<EOF "
#
#
#################################################################
"
EOF
exit 0