Nginx is a web server with a wide range of features, built using modern technologies. It is used by major companies such as Google, Facebook and others.
Before installation, make sure that you do not have Apache2 installed.
Web server installation
Installation is very simple, use the following command:
Configuring Nginx
You need to go to the /etc/nginx/sites-available directory and create a file named "site.conf".
Insert and adjust the following configuration:
Restart Nginx:
PHP notes
PHP is not required for Nginx to operate. This note is relevant only if your site uses PHP.
Using SSL is optional and can be configured if you have a certificate and want to enable it.
You need to create or edit the site configuration so that it looks as follows:
Restart Nginx:
Checking for Apache2
If you install Nginx alongside Apache2, they will conflict over port 80, so one of the web servers must be removed. Check whether Apache2 is installed:
If there is no large status message with detailed information, it means Apache2 is not installed.
If Apache2 is installed, remove it:
Removing Nginx
To completely remove Nginx from the server, first stop the service:
Then run the following command to remove it permanently: