top of page

CÀI NGINX BẰNG EPEL REPOSITORY TRÊN CENTOS 7

Writer's picture: Tuan NguyenTuan Nguyen

Updated: Jul 19, 2018



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.logerror.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.

14 views0 comments

Comments


 

© 2018 by Tuấn Nguyễn

 Liên hệ tôi
  • Facebook - Black Circle
  • Google+ - Black Circle
bottom of page