Opportunities Of Speed ​​Upping NGINX web server on CentOS

This manual describes how to speed up the operation of this web server, and we are talking about CentOS 6 and 7 versions. It is also suitable for both 32-bit and 64-bit architecture

Initial stage

The first thing you should start with is backing up the old configuration and all its data. Having done this, you can use the following command

cd ~
mkdir nginx
cp -r /etc/nginx ~/nginx

Next is the removal of the Nginx web server itself

yum remove nginx

Next up is the installation of OpenSSL and all its dependencies

yum install zlib-devel pcre-devel openssl libssl-devel make gcc gcc-c++ -y

Compiling Nginx

Important! You need to use wget in order to be able to get the source code of Nginx

cd ~ wget https://nginx.org/download/nginx-1.8.0.tar.gz

Following is the unpacking of the archive

tar -xvf nginx-1.8.0.tar.gz

Next step is the assembly and installation of the Nginx web server

cd ~/nginx-1.8.0 ./configure --with-http_spdy_module --with-http_ssl_module --with-http_gzip_static_module make install

Configuring Nginx as a working service. For this, it is recommended to use a third-party script from GitHub for the init.d service

cd /etc/init.d wget https://gist.githubusercontent.com/sairam/5892520/raw/b8195a71e944d46271c8a49f2717f70bcd04bf1a/nginx chmod +x nginx

Configuring Nginx

At this point you can move the old configuration back to the folder в /etc/nginx

Web server loading

service nginx start

Nginx Configuration Editing

vi /etc/nginx/nginx.conf

In the “http” block, you need to add the following:

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 text/JavaScript;

Exit and save the file by pressing the ESC key :wq, then typing, then press Enter

Reload Nginx

service nginx reload

Was this article helpful?

Related Articles

Leave A Comment?