Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- ID=hyundai
- URL=hyundaibidets.com.au
- USER=admin
- # Update the system
- apt-get update
- apt-get upgrade -y
- # @ Configure nginx server block for WordPress
- cat > /etc/nginx/sites-available/$ID <<EOF
- server {
- listen 80;
- listen [::]:80;
- root /var/www/$ID;
- index index.php index.html;
- server_name $URL;
- location / {
- try_files $uri $uri/ /index.php$is_args$args;
- }
- location ~ \.php$ {
- include snippets/fastcgi-php.conf;
- fastcgi_pass unix:/run/php/php7.1-fpm.sock;
- }
- location ~ /\.ht {
- deny all;
- }
- location = /favicon.ico { log_not_found off; access_log off; }
- location = /robots.txt { log_not_found off; access_log off; allow all; }
- location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
- expires max;
- log_not_found off;
- }
- }
- EOF
- # @ Grant privileges to sudo user for mysql
- mysql --user="root" --password="$PASSWORD" -e "CREATE USER '$USER'@'localhost' IDENTIFIED BY '$PASSWORD';"
- mysql --user="root" --password="$PASSWORD" -e "GRANT ALL ON *.* TO '$USER'@'localhost' IDENTIFIED BY '$PASSWORD' WITH GRANT OPTION;"
- mysql --user="root" --password="$PASSWORD" -e "GRANT ALL ON *.* TO '$USER'@'%' IDENTIFIED BY '$PASSWORD' WITH GRANT OPTION;"
- mysql --user="root" --password="$PASSWORD" -e "FLUSH PRIVILEGES;"
- # @ Create WordPress database
- mysql --user="root" --password="$PASSWORD" -e "CREATE DATABASE $ID character set utf8 collate utf8_unicode_ci;"
- service mysql restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement