Cài đặt NGINX trên Centos
dongpolicex2
January 29, 2016
CentOS, Operating System, Trang Chủ
1,452 Views
Cài đặt NGINX trên Centos
vi /etc/yum.repos.d/nginx.repo
# insert
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
#Lưu file lại
# Sau đó tiến hành cài đặt bằng yum
yum install nginx
#Cấu hình proxy by pass
# Edit file /etc/nginx/conf.d/default.conf
vi /etc/nginx/conf.d/default.conf
# Tìm
# location / {
# .....
# }
# Đổi thành
location / {
proxy_pass http://localhost:8080;
}
location /admin {
proxy_pass http://localhost:8081;
}
# Với port 8080 của tomcat và port 8081 của apache
# Với cấu hình như thế khi ta truy cập localhost/ sẽ sử dụng tomcat
# và khi truy cập localhost/admin sẽ sử dụng apache
#Start Nginx
/etc/init.d/nginx start