Install Nginx

1
2
yum install epel-release
yum install nginx -y

Start Nginx

1
2
3
4
5
systemctl start nginx
systemctl enable nginx

systemctl status nginx
nginx -t

Add sites-enable

1
2
3
4
5
6
7
8
9
cd /etc/nginx
mkdir /etc/nginx/sites-enabled/
mkdir /etc/nginx/sites-available

vim /etc/nginx/nxgin.conf

#add too http {}
include /etc/nginx/sites-enabled/*.conf;
server_names_hash_bucket_size 64;

Add new site

1
2
3
4
5
6
7
8
9
10
11
12
13
vim sites-available/YOURSITE.co

#add

server {
listen 80;
server_name YOURSITE.co;

location / {
roxy_pass http://localhost:PORT;
}

}

Soft link

1
ln -s /etc/nginx/sites-available/YOURSITE.co /etc/nginx/sites-enabled/YOURSITE.co

Open http/https port

1
2
3
4
firewall-cmd --list-all
firewall-cmd --permanent --add-port=100/tcp
firewall-cmd --add-service=http --permanent
firewall-cmd --reload

SELinux fix

1
setsebool -P httpd_can_network_connect 1

Restart

1
2
nginx -t
nginx -s reload

Test nginx vhost locally

1
2
vim /etc/hosts
deepbak.net 11.22.33.44