Advertisement
Guest User

Untitled

a guest
May 8th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. #!/bin/bash -e
  2. clear
  3. echo "Database Name: "
  4. read -e dbname
  5. echo "Database User: "
  6. read -e dbuser
  7. echo "Database Password: "
  8. read -s dbpass
  9. echo "FULLPATH to docroot: "
  10. read -e fullpath
  11. echo "Domain Name: (include .com)"
  12. read -e domainname
  13. echo "run install? (y/n)"
  14. read -e run
  15. if [ "$run" == n ] ; then
  16. exit
  17. else
  18. echo "============================================"
  19. echo "INSTALLING..."
  20. echo "============================================"
  21. if [ -d "$fullpath" ]; then
  22. echo "Directory exists... exiting"
  23. exit
  24. else
  25. mkdir $fullpath
  26. cd $fullpath
  27. curl -O https://wordpress.org/latest.tar.gz
  28. tar -zxvf latest.tar.gz
  29. cd wordpress
  30. cp -rf . ..
  31. cd ..
  32. rm -R wordpress
  33. cp wp-config-sample.php wp-config.php
  34. perl -pi -e "s/database_name_here/$dbname/g" wp-config.php
  35. perl -pi -e "s/username_here/$dbuser/g" wp-config.php
  36. perl -pi -e "s/password_here/$dbpass/g" wp-config.php
  37.  
  38.  
  39. perl -i -pe'
  40. BEGIN {
  41. @chars = ("a" .. "z", "A" .. "Z", 0 .. 9);
  42. push @chars, split //, "!@#$%^&*()-_ []{}<>~\`+=,.;:/?|";
  43. sub salt { join "", map $chars[ rand @chars ], 1 .. 64 }
  44. }
  45. s/put your unique phrase here/salt()/ge
  46. ' wp-config.php
  47.  
  48.  
  49. mkdir wp-content/uploads
  50. chmod 775 wp-content/uploads
  51. echo "Cleaning..."
  52. rm latest.tar.gz
  53.  
  54. echo "========================="
  55. echo "Adding nginx entries"
  56. echo "========================="
  57.  
  58. wget https://pastebin.com/raw/mf3UYvi6
  59.  
  60. perl -pi -e "s~PATHTODIR~$fullpath~g" mf3UYvi6
  61. perl -pi -e "s/domainname/$domainname/g" mf3UYvi6
  62.  
  63. mv ./mf3UYvi6 /etc/nginx/sites-available/$domainname
  64. ln -s /etc/nginx/sites-available/$domainname /etc/nginx/sites-enabled/$domainname
  65. echo "Reloading nginx...."
  66. /etc/init.d/nginx reload
  67.  
  68.  
  69. echo "========================="
  70. echo "Installation is complete."
  71. echo "========================="
  72.  
  73. fi
  74. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement