Skip to content

Instantly share code, notes, and snippets.

@parallaxhub
Last active September 26, 2021 17:22
Show Gist options
  • Select an option

  • Save parallaxhub/6752465ce6d9d72c60d2892cfa4afcc6 to your computer and use it in GitHub Desktop.

Select an option

Save parallaxhub/6752465ce6d9d72c60d2892cfa4afcc6 to your computer and use it in GitHub Desktop.
Install WordPress with LEMP on Ubuntu
sudo -i
apt update
apt install nginx
chown -R $USER /var/www/html
chmod -R 755 /var/www/html
nginx -t
ufw app list
ufw allow 'Nginx HTTP'
ufw status
systemctl start nginx
systemctl enable nginx
systemctl daemon-reload
systemctl restart nginx
systemctl reload nginx
systemctl status nginx
curl -4 icanhazip.com
apt update
apt install mariadb-server mariadb-client
mysql_secure_installation
mysql
CREATE DATABASE wordpress;
GRANT ALL ON wordpress.* to 'webmaster'@'localhost' IDENTIFIED BY 'WordP@s6';
use wordpress;
FLUSH PRIVILEGES;
quit
systemctl daemon-reload
systemctl restart mariadb
systemctl status mariadb
systemctl is-enabled mariadb
apt update
apt install php-curl php-mbstring php-soap php-xml php-xmlrpc php-zip
systemctl restart php7.4-fpm
cd /var/www/
wget https://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz
rm -rf latest.tar.gz
chown -R www-data:www-data /var/www/wordpress/
cp -r wp-config-sample.php wp-config.php
nano wp-config.php
# update salt and add mysql wordpress / webmaster / WordP@s6
define( 'DB_NAME', 'wordpress' );
/** MySQL database username */
define( 'DB_USER', 'webmaster' );
# save and exit by ctrl+s and ctrl+x
# add salt
snap install crul
curl -s https://api.wordpress.org/key/1.1/salt/
nano wp-config.php
# add salt
# Save & Exit ctrl+s and ctrl+x
nano /etc/nginx/sites-available/default
# REMOVE ALL TEXT AND ADD BELOWS
server {
listen 80;
listen [::]:80
index index.php index.html index.htm;
server_name example.com www.example.com localhost;
client_max_body_size 100M;
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;
fastcgi_param SCRIPT_FILENAME $document_script_name;
}
}
# Save and exit ctrl+s and ctrl+x
nginx -t
systemctl restart nginx
systemctl reload nginx
systemctl mysql restart
# localhost or 0.0.0.0 or ip address
@parallaxhub
Copy link
Author

Screenshot from 2021-09-26 22-48-24
Screenshot from 2021-09-26 23-22-27
Screenshot from 2021-09-26 23-22-30

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