Nginx

Nginx (pronounced "engine x") is software to provide a web server. Act as a reverse proxy, server for TCP, UDP, HTTP, SMTP, POP3, IMAP protocols, as well as a load balancer and an HTTP cache.

Installation and Configuration

  1. Install Nginx
$ sudo apt-get install nginx
  1. Adjust the firewall
$ sudo ufw app list
  1. Enable the most restrictive profile that will still allow the traffic you've configured
$ sudo ufw allow 'Nginx HTTP'
  1. To start The Nginx service
$ sudo service nginx start
$ sudo service nginx reload
  1. View the status of Nginx
$ sudo service nginx status
  1. Manage the Nginx process
$ sudo systemctl stop nginx
$ sudo systemctl reload nginx
  1. Important Nginx files and directories
(1). /var/www/html/ The actual web content, which consist of default nginx page
(2). /etc/nginx  The nginx: configuration directory
(3). /etc/nginx/nginx.conf: The nginx configuration file
(4). /etc/nginx/site-available: The directory where per-site "server blocks" can be stored.
(5). /etc/nginx/site-enabled: The directory where enabled per-site "server block" are stored.
(6). /etc/nginx/sites-snippets: This directory contains configuration fragments that
 can be included elsewhere in the Nginx configuration.
  1. Server logs
 (1). /var/log/nginx/access.log: Every request to your web server is recorded in this log file unless Nginx 
 is configured to do otherwise.
 (2). /var/log/nginx/error.log: Any Nginx errors will be recorded in this log.
  1. Nginx Full: This profile opens both port 80, and port 443(TLS/SSL encrypted traffic)
  2. Nginx HTTP: This profile opens only port 80
  3. Nginx HTTPS: This profile opens only port 443

Configuration step:

The configuration, the compilation, and the installation. The configuration step allows you to select a number of options that will not be editable after the program is built, as it has a direct impact on the project binaries.

(You could run a ./configure --help command to view all the switches.)

Example: ./configure --conf-path=/etc/nginx/nginx.conf

Switch:

--prefix= The base folder in which Nginx will be installed(If you configure other switches using relative paths, they will connect to the base folder.)

--sbin-path: The path where the Nginx binary file should be installed. <prefix/sbin/nginx>

--conf-path: The path of the main configuration file <prefix>/conf/nginx.conf

--error-log-path: The location of your error log. <prefix>/log/error.log

--pid-path: The path of the Nginx pid file. <prefix>/logs/nginx.pid

--lock-path: The location of the lock file. <prefix>/logs/nginx.lock(whether the program is start or not)

--with-perl_modules_path: Defines the path to the perl module.

--with-perl: Path to the perl binary file, used to execute perl script.

--http-log-path: Define the location of the access logs. <prefix>/logs/access.log

--http-client-body-temp-path: Directory used for storing temporary files generated by client request.

--http-fastcgitemp-path

--http-uwsgitemp-path

--http-scgitemp-path : Location of the temporary files used by the HTTP FastCGI, uWSGI, and SCGI module.

--builddir: Location of the application build.

  1. Prerequisites options

Prerequisites come in the form of libraries and binaries.

results matching ""

    No results matching ""