wordpress server - RLidea/dev.docs GitHub Wiki

Ubuntu Server 20.04 LTS (HVM), SSD Volume Type - ami-007b7745d0725de95

Install Server & php

sudo apt update && apt upgrade -y
sudo apt install -y nginx
sudo apt install -y php7.4-fpm php7.4-gd php7.4-json php7.4-mysql php7.4-curl php7.4-mbstring php7.4-intl php-imagick php7.4-xml php7.4-zip

WordPress

wget -c http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz wordpress
sudo chown -R www-data:www-data wordpress

Settings

$ sudo dpkg-reconfigure tzdata
Current default time zone: 'Asia/Seoul'

nginx

sudo vi /etc/nginx/sites-available/default
server {
  server_name what-day.net;
  root /home/ubuntu/what-day.net;
  index index.php index.html index.htm index.nginx-debian.html;

  location / {
    try_files $uri $uri/ /index.php;
  }

  error_page 404 /404.html;
  error_page 500 502 503 504 /50x.html;

  client_max_body_size 8M;

  location = /50x.html {
    root /usr/share/nginx/html;
  }

  location ~ \.php$ {
    fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    include snippets/fastcgi-php.conf;
  }

  #enable gzip compression
  gzip on;
  gzip_vary on;
  gzip_min_length 1000;
  gzip_comp_level 5;
  gzip_types application/json text/css application/x-javascript application/javascript image/svg+xml;
  gzip_proxied any;

  # A long browser cache lifetime can speed up repeat visits to your page
  location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
    access_log        off;
    log_not_found     off;
    expires           360d;
  }

  # disable access to hidden files
  location ~ /\.ht {
    access_log off;
    log_not_found off;
    deny all;
  }

  listen [::]:443 ssl ipv6only=on; # managed by Certbot
  listen 443 ssl; # managed by Certbot
  ssl_certificate /etc/letsencrypt/live/what-day.net/fullchain.pem; # managed by Certbot
  ssl_certificate_key /etc/letsencrypt/live/what-day.net/privkey.pem; # managed by Certbot
  include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
  if ($host = what-day.net) {
    return 301 https://$host$request_uri;
      } # managed by Certbot


  listen 80;
  listen [::]:80;
  server_name what-day.net;
  return 404; # managed by Certbot
}

php

vi /etc/php/7.4/cli/php.ini
vi /etc/php/7.4/fpm/php.ini
date.timezone = Asia/Seoul
upload_max_filesize = 8M

sudo service php7.4-fpm restart