NGINX & PHP5-FPM OPTIMIZATION

NGINX & PHP5-FPM OPTIMIZATION

NGINX Optimization?

The default configuration of Nginx is very pretty good for normal web server but if you want to establish high performance Nginx  Web server  then you need to make some changes in Nginx configuration file.

Let’s have a look on /etc/nginx/nginx.conf (Main Nginx configuration file)

root@test:~# vim /etc/nginx/nginx.conf
user www-data; #Same as Apache server Nginx also need User Privileges for working as web server, www-data is default user for web server roles in Ubuntu/Debian.

worker_processes 4; #You should set the value to the number of CPU cores available in your server


pid /run/nginx.pid; #Its the default path of Nginx process file you can change it according.

events {
worker_connections 1024; #configure your server to the amount of total traffic you expect to receive. Total number of connection=worker_processes*worker_connections.
}

http {
#################BASIC SETTING#######################
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10; #set keepalive_timeout 10-12 sec. for better performance
keepalive_requests 100000; # configure based on you concurrent connection & througput
types_hash_max_size 2048;
server_tokens off; #Hide your Nginx version information


include /etc/nginx/mime.types;
default_type application/octet-stream;


################ Logging Settings ########################


access_log /var/log/nginx/access.log; #Defalut access Log File
error_log /var/log/nginx/error.log; #Default error log file

##################Gzip Settings###############################

gzip on; #Enable Gzip Compression on web-root documents
gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;


############### Virtual Host Configs#########################

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

Leave a Reply

Time limit is exhausted. Please reload the CAPTCHA.