1. (Optional) Run with sudo user
1
sudo su -
2. Install needed packages and nginx
1
2
3
4
5
yum install epel-release
yum update
yum -y install nginx
3. Start nginx
1
2
3
4
5
systemctl enable nginx
systemctl start nginx
systemctl status nginx
Some useful commands
1
2
3
4
5
6
7
8
9
systemctl stop nginx
systemctl restart nginx
# Reload nginx after configuration is changed
systemctl reload nginx
# Turn off auto-start when restart VPS
systemctl disable nginx