Skip to content

Instantly share code, notes, and snippets.

@tanftw
Last active June 15, 2024 05:00
Show Gist options
  • Save tanftw/6e6e8d2c14db85b5f5a5ca5f7c2d18e0 to your computer and use it in GitHub Desktop.
Save tanftw/6e6e8d2c14db85b5f5a5ca5f7c2d18e0 to your computer and use it in GitHub Desktop.
Install LEMP stack for WordPress
# MySQL
sudo apt install mysql-server
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '11';
sudo mysql_secure_installation
sudo systemctl restart mysql
# PHP 7.4 because WP sucks at PHP8
sudo apt install software-properties-common apt-transport-https -y
sudo apt install php php-cli php-mysql php-mbstring php-xml php-curl php-fpm
## Crontab
*/10 * * * * cd /var/www; php /var/www/wp-cron.php?doing_wp_cron > /dev/null 2>&1
## Nginx Block
server {
listen 80;
root /var/www/pma;
index index.php index.html index.htm index.nginx-debian.html;
server_name pma.test;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
@tanftw
Copy link
Author

tanftw commented Feb 11, 2024

With Self signed Certificate

server {
        listen 80;
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        server_name localhost;
        ssl_certificate /etc/ssl/certs/localhost.crt;
        ssl_certificate_key /etc/ssl/private/localhost.key;

        ssl_protocols TLSv1.2 TLSv1.1 TLSv1;

        #root /var/www/gif84;
        root /var/www/wp;
        index index.php index.html index.htm index.nginx-debian.html;
        server_name localhost;
        client_max_body_size 256M;
        location / {
           try_files $uri $uri/ /index.php?$args;
        }

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

        location ~ /\.ht {
                deny all;
        }
}

@tanftw
Copy link
Author

tanftw commented Feb 11, 2024

Create SSC

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/localhost. Key -out /etc/ssl/certs/localhost.crt

Note that entity should be match with file name ("localhost")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment