-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaravel5.sh
executable file
·43 lines (30 loc) · 929 Bytes
/
laravel5.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
#!/bin/bash
domain=$1
root="/var/www/$domain"
block="/etc/nginx/sites-available/$domain"
# Create the Document Root directory
sudo mkdir -p $root
# Assign ownership to your regular user account
sudo chown -R $USER:$USER $root
# Create the Nginx server block file:
sudo tee $block > /dev/null <<EOF
server {
listen 80;
listen [::]:80;
root /var/www/html/$domain/public;
index index.php index.html index.htm ;
server_name $domain ;
location / {
#try_files \$uri \$uri/ =404;
try_files \$uri \$uri/ /index.php\$is_args\$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
}
EOF
# Link to make it available
sudo ln -s $block /etc/nginx/sites-enabled/
# Test configuration and reload if successful
sudo nginx -t && sudo service nginx reload