top of page

HƯỚNG DẪN CÀI ĐẶT NGINX BẰNG REPO NGINX TRÊN CENTOS 7

Updated: Jul 19, 2018

Các bước thực hiện:

  • Tạo repo nginx

  • Import chữ ký số

  • Tiến hành cài nginx

  • Mở port cho nginx


1. Tạo repo Nginx


# vi /etc/yum.repos.d/nginx.repo

[nginx]

name=nginx repo

baseurl=http://nginx.org/packages/centos/7/$basearch/


2. Import chữ ký số

# wget --no-check-certificate -O nginx_signing.key https://nginx.org/keys/nginx_signing.key
# rpm --import nginx_signing.key

3. Cài đặt Nginx


# yum update
# yum --disablerepo=* --enablerepo=nginx install nginx -y

Khởi động dịch vụ nginx

# systemctl start nginx
# systemctl enable nginx

Kiểm tra

# ps -auxfw | grep -v "grep" | grep "nginx"

root 10694 0.0 0.0 110260 980 pts/0 T 13:58 0:00 \_ less /etc/yum.repos.d/nginx.repo

root 10792 0.0 0.0 46364 964 ? Ss 14:01 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf

nginx 10793 0.0 0.2 46764 2168 ? S 14:01 0:00 \_ nginx: worker process

# netstat -atnlp | grep ":80"

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 10792/nginx: master


4. Mở port cho dịch vụ Nginx

# firewall-cmd --get-default-zone

public

# firewall-cmd --zone=public --permanent --add-port=80/tcp

success

# firewall-cmd --reload

success

Đường dẫn cấu hình file index.html

/usr/share/nginx/html

Comments


 

© 2018 by Tuấn Nguyễn

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