nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server.
nginx is pretty easy and starlight forward. To install
nginx use the following command(s)
sudo apt-get update
sudo apt-get -y install nginx
These should install and start the web-server service. To check the current status of
nginx, use the
sudo systemctl status nginx
If the installation of
nginx went properly the above command should produce an output like below
● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2018-01-08 10:49:15 CEST; 15s ago Main PID: 2446 (nginx) CGroup: /system.slice/nginx.service ├─2446 nginx: master process /usr/sbin/nginx -g daemon on; master_process on ├─2447 nginx: worker process ├─2448 nginx: worker process ├─2449 nginx: worker process └─2450 nginx: worker process Jan 08 10:49:15 integration-server systemd: Starting A high performance web server and a reverse proxy server... Jan 08 10:49:15 integration-server systemd: Started A high performance web server and a reverse proxy server.
This shows that the
nginx has been installed properly and the service is running. Now we need to configure
nginx to serve as per our requirement.
Please make sure that the following configurations are available in
worker_connections 2000; server_tokens off; client_max_body_size 100M; server_names_hash_bucket_size 128;
Once finish editing
/etc/nginx/nginx.conf please check the Nginx config, if it is ok or not by using the following command
sudo nginx -t
The above command should output something like below
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
nginx for applying these changes.
sudo systemctl restart nginx
nginx is a personal choice here, you can also reload the configuration without restarting
sudo nginx -s reload
If everything is fine we should be able to see the
nginx welcome message in the browser also.
Browser window should look similar to below image