BlitzinBuffalo
11/20/2018 - 8:47 PM

wordpress nginx (ubuntu)

wordpress nginx (ubuntu)

  1. install nginx
sudo apt update
sudo apt -y install nginx
  1. install php
sudo apt install php-fpm php-mysql
  1. configure nginx
sudo vi /etc/nginx/sites-available/default
server {
        listen 80;
        root /var/www/html;
        index index.php index.html index.htm index.nginx-debian.html;
        server_name example.com;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        }

        location ~ /\.ht {
                deny all;
        }
}
sudo nginx -t
sudo systemctl reload nginx
  1. install certbot
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx