Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. ID=hyundai
  4. URL=hyundaibidets.com.au
  5. USER=admin
  6.  
  7. # Update the system
  8. apt-get update
  9. apt-get upgrade -y
  10.  
  11. # @ Configure nginx server block for WordPress
  12. cat > /etc/nginx/sites-available/$ID <<EOF
  13. server {
  14. listen 80;
  15. listen [::]:80;
  16.  
  17. root /var/www/$ID;
  18. index index.php index.html;
  19.  
  20. server_name $URL;
  21.  
  22. location / {
  23. try_files $uri $uri/ /index.php$is_args$args;
  24. }
  25.  
  26. location ~ \.php$ {
  27. include snippets/fastcgi-php.conf;
  28. fastcgi_pass unix:/run/php/php7.1-fpm.sock;
  29. }
  30.  
  31. location ~ /\.ht {
  32. deny all;
  33. }
  34.  
  35. location = /favicon.ico { log_not_found off; access_log off; }
  36. location = /robots.txt { log_not_found off; access_log off; allow all; }
  37. location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
  38. expires max;
  39. log_not_found off;
  40. }
  41. }
  42. EOF
  43.  
  44. # @ Grant privileges to sudo user for mysql
  45. mysql --user="root" --password="$PASSWORD" -e "CREATE USER '$USER'@'localhost' IDENTIFIED BY '$PASSWORD';"
  46. mysql --user="root" --password="$PASSWORD" -e "GRANT ALL ON *.* TO '$USER'@'localhost' IDENTIFIED BY '$PASSWORD' WITH GRANT OPTION;"
  47. mysql --user="root" --password="$PASSWORD" -e "GRANT ALL ON *.* TO '$USER'@'%' IDENTIFIED BY '$PASSWORD' WITH GRANT OPTION;"
  48. mysql --user="root" --password="$PASSWORD" -e "FLUSH PRIVILEGES;"
  49. # @ Create WordPress database
  50. mysql --user="root" --password="$PASSWORD" -e "CREATE DATABASE $ID character set utf8 collate utf8_unicode_ci;"
  51. service mysql restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement