-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmp.sh
More file actions
executable file
·70 lines (57 loc) · 1.39 KB
/
mp.sh
File metadata and controls
executable file
·70 lines (57 loc) · 1.39 KB
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
#!/bin/bash
regexp="^(https|git@).*\/([a-z-]*)\.git$"
if [ -n "$1" ]
then
[[ $1 =~ $regexp ]]
reponame=${BASH_REMATCH[2]}
fi
if [ -z "$reponame" ]
then
echo "Invalid git repository url"
exit
fi
cd ./www
git clone $1
if [ -n "$2" ]
then
projectname=$2
mv ./$reponame ./$projectname
else
projectname=$reponame
fi
cd ../hosts
touch $projectname.local.conf
echo 'server {
listen *:80;
server_name '$projectname'.local;
root /var/www/'$projectname'/public/;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass php:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
location ~ \.php$ {
return 404;
}
error_log /var/log/nginx/'$projectname'_error.log;
access_log /var/log/nginx/'$projectname'_access.log;
}' > ./$projectname.local.conf
cd ../
docker-compose up -d
docker exec -i -t php-dev-env_nginx_1 nginx -s reload
echo " "
echo 'To add domain to hosts file you must use root privileges:'
sudo -i << EOF
echo '
127.0.0.1 '$projectname'.local' >> /etc/hosts
EOF
echo " "
echo 'To access the project enter '$projectname'.local in browser.'
echo 'Now you must go to create DB and configure project environment.'
exit