In this article we will install latest nginx/1.14.1 in Centos 7.
1. Remove current version of nginx (1.12.2)
sudo yum remove nginx*
1.1 (optional) You can also move nginx configuration folder into different one, so that your installation will be clean, without any old configs. Then you just need to enable your sites again, one by one.
sudo mv /etc/nginx/ /etc/nginx.bak
2. Disable nginx from centos repo:
# open this file sudo vi /etc/yum.repos.d/epel.repo # and append one line to [epel] section: [epel] ... exclude=nginx*
3. Create file /etc/yum.repos.d/nginx.repo:
sudo vi /etc/yum.repos.d/nginx.repowith the following content:
[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/7/$basearch/ gpgcheck=0 enabled=1
4. Update
sudo yum update
5. Install nginx (1.14.1)
sudo yum install nginx
6. Enable nginx service and start it
sudo systemctl enable nginx sudo systemctl start nginx
7. Check nginx status:
sudo systemctl status nginxYou should see something like this:
● nginx.service - nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2018-11-07 07:28:58 UTC; 6s ago Docs: http://nginx.org/en/docs/ Process: 31152 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS) Main PID: 31153 (nginx) CGroup: /system.slice/nginx.service ├─31153 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf └─31154 nginx: worker process
It means that nginx is installed successfully.
P.S. If you're using fastcgi in nginx, please also check this article.
No comments:
Post a Comment