-
Notifications
You must be signed in to change notification settings - Fork 0
/
4.ConfigVirtualHost.sh
44 lines (41 loc) · 1.56 KB
/
4.ConfigVirtualHost.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
#!/bin/bash
# Haciendo backup de la configuracion de 000-default.conf
echo "Haciendo backup de la configuracion de 000-default.conf"
mv /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf.bk
# Creando el VirtualHost en 000-default.conf
echo "Creando el VirtualHost en 000-default.conf"
cat << EOF > /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/aeroclub/public
<Directory /var/www/html/aeroclub/public>
AllowOverride None
DirectoryIndex index.php
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
RewriteRule .* - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .+
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 307 ^/$ /index.php/
</IfModule>
</IfModule>
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOF
# Reiniciando servicio apache
echo "Reiniciando servicio apache"
sudo systemctl restart apache2