Note_Tech

All technological notes.


Project maintained by simonangel-fong Hosted on GitHub Pages — Theme by mattgraham

Project - Wordpress-Mysql-Nginx-Ubuntu

Back


Install packages

# update packages
sudo apt update -y

# install NGINX.
sudo apt install -y nginx

# Install and Configure the MySQL Database Server
sudo apt install -y mysql-server

# Install PHP
sudo apt install -y php-fpm

# Install the required PHP modules.
sudo apt install -y php-mysql php-curl php-mbstring php-imagick php-xml php-zip

# Install unzip
sudo apt install -y unzip

Configure the MySQL Database Server

# create a database named "wordpress"
sudo mysqladmin create wordpress
# Connect to the MySQL server
sudo mysql
CREATE USER wordpress@localhost identified by 'wordpress123';
GRANT ALL on wordpress.* to wordpress@localhost;
exit

Configure NGINX

# update the default NGINX configuration.
cd /etc/nginx/sites-available/
sudo vi default
index index.html index.htm index.nginx-debian.html;

to:

index index.php index.html index.htm index.nginx-debian.html;

try_files $uri $uri/ =404;

to:

try_files $uri $uri/ /index.php$is_args$args;

#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}

to:

location ~ \.php$ {
  include snippets/fastcgi-php.conf;
  # With php-fpm (or other unix sockets):
  # change the path of sock as necessary.
  fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
  # # With php-cgi (or other tcp sockets):
  # fastcgi_pass 127.0.0.1:9000;
}

# check syntax error
sudo nginx -t
# reload
sudo systemctl reload nginx

Download WordPress

cd ~
# download latest wordpress
curl -O https://wordpress.org/latest.zip
unzip latest.zip
sudo mv wordpress/* /var/www/html

Assign File Permissions for WordPress

sudo chown -R www-data:www-data /var/www/html

Determine Your IP Address

ip a
# 192.168.204.154

Complete the Web Application Install


TOP