Linux Linux help

 

Nginx Server

1. How to install Nginx Server?

In Linux Mint you can install Nginx (Web Server) in two ways:

a) Administration, Software Manager. Type in 'apache' in the search box and select Nginx (Small, powerful, scalable web/proxy server) from the list.

b) From the command line, enter the following commands.

$ sudo apt-get update

$ sudo apt-get install nginx

It will install the following components: libnginx-mod-http-image-filter, libnginx-mod-http-xslt-filter, libnginx-mod-mail, libnginx-mod-stream, nginx, nginx-common, nginx-core.
The main tool to control nginx is with the systemctl command or via signals.

2. How do I install additional libraries and utilities?

Nginx will work by default with plain HTML web pages but if you need scripting with PHP, Python or Perl etc then you need to install additional tools and libraries.

a) PHP support.

To install php fast process manager (FPM) for nginx, run apt-get install php-fpm. This will install these components: php-fpm and php7.4-fpm. The module will allow
php scripts to run within a nginx website. If you need the command line version too, then run apt-get install php7.4-cli.

b) Python support.

To install python3, run apt-get install python3. This will install the following components: python3-minimal, python3.8, libpython3-stdlib, python3-doc, python3-tk, python3-venv,
python3.

To install python packages you will need the Pip, a python package manager which allows to install packages by name. Run apt-get install python3-pip.

3. How do I configure a web site in Nginx?

To configure a website you need to create a configuration file, also known as a vhost (virtual host) file with special directives for the website, usually located in /etc/apache2/sites-available folder.
For example, see these nginx configurations.

Now test the site by loading a web browser and enter http://localhost, http://ip-address or http://website-address (if configured in DNS or /etc/hosts).