Updating NGINX 1.4.6 to 1.8.x on Ubuntu 14.04 and fixing limit_zone errors

Learn | Teach Open Source Technologies

Updating NGINX 1.4.6 to 1.8.x on Ubuntu 14.04 and fixing limit_zone errors

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get upgrade

root@www:~# apt-get upgrade nginx
Reading package lists... Done
Building dependency tree 
Reading state information... Done
Calculating upgrade... Done
nginx is already the newest version.
The following packages have been kept back:
 linux-generic linux-headers-generic linux-image-generic
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
root@www:~# nginx -v
nginx version: nginx/1.8.0
root@www:~# 
root@www:~# /etc/init.d/nginx restart
 * Restarting nginx nginx
 ...fail.
root@www:~#

 

Above we can see the service of NGINX was failed After updating NGINX from 1.4.6 to 1.8.x  and giving errors, to check the errors log we will run below command

tailf /var/log/nginx/errors.log

To fix this issue we will open NGINX.conf file using below command

vi /etc/nginx/nginx.conf
#######Add below line
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
######disable below limit_zone & limit_cone parameters
##limit_zone slimits $binary_remote_addr 5m;
##limit_conn slimits 5;

Open below file default site in NGINX to fix the blank screen error in WordPress

vi /etc/nginx/sites-enabled/default

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
##Add below line to fix the blank screen error
include fastcgi.conf;
}



root@www:~# /etc/init.d/nginx restart
 * Restarting nginx nginx
 ...done.