-
Notifications
You must be signed in to change notification settings - Fork 0
/
wpinstall.sh
31 lines (23 loc) · 1.17 KB
/
wpinstall.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
#!/bin/bash
if [ $(id -u) -ne 0 ]
then
sudo $0
exit 0
fi
cp "/home/$ruser/wordpress/wp-config-sample.php" "/home/$ruser/wordpress/wp-config.php"
sed -i -e "s/database_name_here/$database/g" "/home/$ruser/wordpress/wp-config.php"
sed -i -e "s/username_here/$username/g" "/home/$ruser/wordpress/wp-config.php"
sed -i -e "s/password_here/$password/g" "/home/$ruser/wordpress/wp-config.php"
sed -i -e "s/wp_/$prefix/g" "/home/$ruser/wordpress/wp-config.php"
rsync -avpP "/home/$ruser/wordpress/" "/srv/www/$sitename/public/"
chown -R $ruser:www-data "/srv/www/$sitename/public/"
mkdir -p "/srv/www/$sitename/public/wp-content/uploads"
chown -R :www-data "/srv/www/$sitename/public/wp-content/uploads"
# nginx server blocks, must use provided default
# wget https://raw.githubusercontent.com/LuciferIAm/ScriptsnStuff/master/autodef ~/etc/nginx/sites-available/
cp "/etc/nginx/sites-available/autodef" "/etc/nginx/sites-available/$sitename"
sed -i -e "s/example.com/$sitename/g" "/etc/nginx/sites-available/$sitename"
ln -s "/etc/nginx/sites-available/$sitename" "/etc/nginx/sites-enabled/"
service nginx restart
service php5-fpm restart
#install finished! just go to your site now!