Guest User

Untitled

a guest
Jan 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #!/bin/sh
  2. domain="$1" && test -z ${domain} && return
  3. read -sp "What's your DB root password?" dbrootp
  4. read -sp "What's your DB user password?" dbuserp
  5. cd ${drt} && mkdir ${domain}
  6.  
  7. cat <<-WEBAPPBASE > /etc/nginx/sites-available/${domain}.conf
  8. server {
  9. root ${drt}/${domain};
  10. server_name ${domain} www.${domain};
  11. location ~* .(jpg|jpeg|png|gif|ico|css|js|ttf|woff|pdf)$ {expires 365d;}
  12. }
  13. WEBAPPBASE
  14. ln -s /etc/nginx/sites-available/${domain}.conf /etc/nginx/sites-enabled/
  15. certbot --nginx -d ${domain} -d www.${domain}
  16.  
  17. cat <<-DBSTACK | mysql -u root -p"${dbrootp}"
  18. CREATE USER "${domain}"@"localhost" IDENTIFIED BY "${dbuserp}";
  19. CREATE DATABASE "${domain}";
  20. GRANT ALL PRIVILEGES ON ${domain}.* TO "${domain}"@"localhost";
  21. DBSTACK
  22.  
  23. wp core download --path=${drt}/${domain}
  24. wp config create --path=${drt}/${domain} --dbname=${domain} --dbuser=${domain} --dbpass=${dbuserp} --dbhost="localhost"
  25.  
  26. chown -R www-data:www-data ${domain}/*
  27. chmod -R a-x,a=rX,u+w ${domain}/*
  28. /etc/init.d/php*-fpm restart && systemctl restart nginx.service
Add Comment
Please, Sign In to add comment