[Fixed] : How To Install WordPress on Oracle Cloud Always Free - Nginx Not Listening Problem





 [Live & Running]


The Following Are The SSH Command


1. Enable Super Admin 

sudo su -

2 : Update & Upgrade Command


sudo apt update
sudo apt upgrade


3. Firewall Update


sudo apt install ufw
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw enable

4: Install NGINX Command


sudo apt install nginx

5: Check Nginx Status


service nginx status

It should display like this

..Output
...
root@ubuntu-nginx-test:~# service nginx status
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; disabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-07-21 02:34:01 IST; 41s ago
       Docs: man:nginx(8)
   Main PID: 16743 (nginx)
      Tasks: 2 (limit: 2010)
     Memory: 4.0M
     CGroup: /system.slice/nginx.service
             ├─16743 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             └─16744 nginx: worker process

Jul 21 02:34:01 ubuntu-nginx-test systemd[1]: Starting A high performance web server and a reverse proxy server...
Jul 21 02:34:01 ubuntu-nginx-test systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argu>
Jul 21 02:34:01 ubuntu-nginx-test systemd[1]: Started A high performance web server and a reverse proxy server.
lines 1-14/14 (END)


6: Enable IPTables Entry

sudo iptables -I INPUT 2 -p tcp --dport 443 -j ACCEPT
sudo iptables -I INPUT 2 -p tcp --dport 80 -j ACCEPT
sudo iptables-save > /etc/iptables/rules.v4


7 : Check On Browser Using IP Address



8 : Install PHP with required Mods


sudo apt install php7.4-fpm php7.4-common php7.4-mysql \
php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd \
php7.4-imagick php7.4-cli php7.4-dev php7.4-imap \
php7.4-mbstring php7.4-opcache php7.4-redis \
php7.4-soap php7.4-zip -y

9 : Check PHP Version

sudo php -v


..Output
...
root@ubuntu-nginx-test:~# php -v
PHP 7.4.21 (cli) (built: Jul  1 2021 16:09:41) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.21, Copyright (c), by Zend Technologies

10 : Install MaraiDB Server

sudo apt install mariadb-server -y


11 : Secure MaraiDB Server


sudo mysql_secure_installation


..output
...
root@ubuntu-nginx-test:~# sudo mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
 ... Success!

You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
 ... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
 ... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!


12. Login MariaDB / Mysql CLI


sudo mysql -u root -p

13 : Create Database


CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;

14 : Create User & Set Password


CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'password';


15: Grant Privileges


GRANT ALL PRIVILEGES ON wordpress.* TO wp_user@localhost IDENTIFIED BY 'password';

16: Flush Privileges & Exit


FLUSH PRIVILEGES;
exit;


17: Download & Install Wordpress 


cd /

cd tmp

wget -c https://wordpress.org/latest.tar.gz


18: Extract Wordpress Zip File


tar -xvzf latest.tar.gz

19: Create Site Directory


sudo mkdir /var/www/html/sitename


20 : Copy Extracted File Into Site Directory


sudo rsync -avP wordpress/ /var/www/html/sitename


21: Give Writeable Permission to Site Directory


sudo chown -R www-data:www-data /var/www/html/sitename
sudo chmod 755 -R /var/www/html/sitename


22: Edit Nginx Config File For WordPress


sudo nano /etc/nginx/sites-available/default
server{
 listen 80 default_server;
 listen [::]:80 default_server;
 root /var/www/html;
 index index.php index.html index.htm index.nginx-debin.html;
 server_name server_domain_or_IP;
 
 location / {
  try_files $url $url/ -404;
 }
 location ~ \.php$ {
  include $nippets/fastcgi.php.conf;
  fastcgi_pass unix:/run/php/php7.4-fpm.sock;
 }
 location ~ /\.ht {
  deny all;
 }
}

sudo nginx -t
sudo systemctl reload nginx


Now Open Your Webiste



Continue The Installation

Thats All !



Comments

Popular posts from this blog

[Free] How To Install WordPress with Nginx in Ubuntu 20.04 Oracle Cloud?

Is Time Travel Possible ?

[Fixed]My network requests are not working in Android Pie!