How to install setup NGINX on Oracle Linux

How to install setup NGINX on Oracle Linux



Step 1 — Adding the EPEL Software Repository

sudo yum install epel-release


You’ll be prompted to verify that you want to install the software. Type y then ENTER to continue.


Step 2 — Installing Nginx


sudo yum install nginx


Again, answer yes to the verification prompt, then Nginx will finish installing.


Step 3 — Starting Nginx


Nginx will not start automatically after it is installed. To get Nginx running, use the systemctl command:

sudo systemctl start nginx

sudo systemctl enable nginx

sudo systemctl status nginx

Output 

● nginx.service - The nginx HTTP and reverse proxy server

   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)

   Active: active (running) since Mon 2022-01-24 20:14:24 UTC; 5s ago

  Process: 1898 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)

  Process: 1896 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)

  Process: 1895 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

 Main PID: 1900 (nginx)

   CGroup: /system.slice/nginx.service

           ├─1900 nginx: master process /usr/sbin/nginx

           └─1901 nginx: worker process



If you are running a firewall, run the following commands to allow HTTP and HTTPS traffic:

sudo firewall-cmd --permanent --zone=public --add-service=http


sudo firewall-cmd --permanent --zone=public --add-service=https

sudo firewall-cmd --reload

access on browser

http://server_domain_name_or_IP/


Step 4 — Exploring and Configuring Nginx


If you want to start serving your own pages or application through Nginx, you will want to know the locations of the Nginx configuration files and default server root directory.

Default Server Root

The default server root directory is /usr/share/nginx/html. Files that are placed in there will be served on your web server. This location is specified in the default server block configuration file that ships with Nginx, which is located at /etc/nginx/conf.d/default.conf.

Server Block Configuration

Any additional server blocks, known as Virtual Hosts in Apache, can be added by creating new configuration files in /etc/nginx/conf.d. Files that end with .conf in that directory will be loaded when Nginx is started.

Nginx Global Configuration

The main Nginx configuration file is located at /etc/nginx/nginx.conf. This is where you can change settings like the user that runs the Nginx daemon processes, 


DOWNLOAD SUPPORT DOCUMENT

Post a Comment

0 Comments