Add 'sudo' and Step 3 - 4 (#33067)

Add sudo at the first of each syntax line and added Step 3 (firewall adjustment) and Step 4 (check nginx service)
This commit is contained in:
Muh Fachrul Razy
2019-04-29 01:01:51 +08:00
committed by Christopher McCormack
parent bee5145d8f
commit c8d39b6658

View File

@ -1,25 +1,38 @@
--- ---
title: Installation of Nginx in Ubuntu title: Nginx
--- ---
# Nginx
## Introduction ## Introduction
- Nginx is a web server which can also be used as a reverse proxy, load balancer and HTTP cache. - Nginx is a web server which can also be used as a reverse proxy, load balancer and HTTP cache.
- It is one of the most popular web servers in use and is responsible for hosting some of the largest and highest-traffic sites on the internet. - It is one of the most popular web servers in use and is responsible for hosting some of the largest and highest-traffic sites on the internet.
- It is proven to be lighter on resources than httpd/Apache. - It is proven to be lighter on resources than httpd/Apache.
- Nginx is free and open-source software, first released in 2004. - Nginx is free and open-source software, first released in 2004.
## Installation of Nginx on Ubuntu ## Installation
### Installation of Nginx on Ubuntu
Update the local package index and install Nginx from default repositories: Update the local package index and install Nginx from default repositories:
```sh ```sh
$ sudo apt update $ sudo apt-get update && sudo apt-get upgrade
$ sudo apt install nginx $ sudo apt-get install nginx
$ sudo systemctl status nginx # will check if the server is running as the installation should have started it already $ sudo systemctl status nginx
``` ```
## Installation of Nginx on CentOS 7 Enable nginx on the firewall using `ufw`
```sh
sudo ufw allow 'Nginx HTTP'
```
Validate nginx is running:
```sh
systemctl status nginx
```
### Installation of Nginx on CentOS 7
Add Nginx repository and install: Add Nginx repository and install:
@ -49,7 +62,6 @@ $ sudo systemctl start nginx # will start the server
#### More Information #### More Information
[An Introduction to NGINX for Developers](https://medium.freecodecamp.org/an-introduction-to-nginx-for-developers-62179b6a458f) [An Introduction to NGINX for Developers](https://medium.freecodecamp.org/an-introduction-to-nginx-for-developers-62179b6a458f)
[Nginx tutorial](https://www.netguru.co/codestories/nginx-tutorial-basics-concepts) [Nginx tutorial](https://www.netguru.co/codestories/nginx-tutorial-basics-concepts)
[Links to top tutorials](https://medium.com/quick-code/top-tutorials-to-learn-nginx-for-web-server-dc8638c48fae) [Links to top tutorials](https://medium.com/quick-code/top-tutorials-to-learn-nginx-for-web-server-dc8638c48fae)