![](https://static.wixstatic.com/media/68165d_66d6c1d0c88c4414a7d2686df4b99c35~mv2.png/v1/fill/w_980,h_490,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_66d6c1d0c88c4414a7d2686df4b99c35~mv2.png)
1. Enable EPEL Repository
Các packages Nginx có sẵn trong Epel Repository. Nếu chưa cài Epel thì ta tiến hành cài đặt nó.
# yum install epel-release
2. Cài Nginx
# yum install nginx
Start và enable Nginx
# systemctl start nginx
# systemctl enable nginx
Xem version Nginx đã cài
# nginx -v
3. Cấu hình firewall cho chạy Nginx
# firewall-cmd --zone=public --permanent --add-port=80/tcp
# firewall-cmd --zone=public --permanent --add-port=443/tcp
# firewall-cmd --reload
4. Cấu trúc file trong Nginx và một số khuyến nghị
Tất cả các file cấu hình nằm trong: /etc/nginx
File cấu hình chính của Nginx: /etc/nginx/nginx.conf
Để dễ cho việc quản lý và bảo trì khuyến nghị nên tạo các file cấu hình riêng cho mỗi tên miền.
Mỗi file server block phải kết thúc bằng .conf và được lưu trong /etc/nginx/conf.d. Bạn có thể tạo nhiều server block.
Các file log (access.log và error.log) được lưu trong /var/log/nginx. Khuyến nghị nên tạo các file log riêng cho mỗi server block.
Comments