Nginx User Manual

Posted Jun 15, 20202 min read

  1. Connect the Little Red Riding Hood system(SecureCRT)

  2. Download the Nginx source package(download address )

  3. Install the dependent packages on the Little Red Riding Hood system:

yum -y install gcc gcc-c++ autoconf automake(basic environment)

yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel(required for some functions)

yum -y install gd-devel(support thumbnail module)

  1. Compile and install Nginx:

4.1. Create nginx user

useradd -r nginx -s /sbin/nologin

4.2. Upload and unzip the nginx source package

tar -zxf nginx-1.13.8.tar.gz

cd nginx-1.13.8

4.3. Compile

./configure --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_stub_status_module --with-http_realip\ _module --with-http_sub_module --with-http_flv_module --with-http_dav_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_addition_module --with-http_image_filter_module --with-pcre --with-stream --with-stream_ssl_module --with-http_mp4_module - with-ld-opt=-Wl,-rpath,/usr/local/lib

4.4. Installation

make && make install

  1. Manage Nginx services

/usr/local/nginx/sbin/nginx - start

/usr/local/nginx/sbin/nginx -s reload - reload the configuration file

/usr/local/nginx/sbin/nginx -t --verifies the correctness of the configuration file

ps -ef | grep nginx - check if the nginx service is started

  1. Modify the configuration file(edit the file vi /usr/local/nginx/conf/nginx.conf)

Shift+G(to the last line), gg(to the first line)

o(insert data in the next line of the current cursor), i(current cursor edit file), ESC(exit edit mode)

To exit the edit mode to go to the first line or the last line

Save the file and exit:Press(:wq!) after exiting the edit mode to save and exit(::q!) Exit without saving

server {

Listen 2020;

\ server_name;


Roots /home/dever/html/web4/;

try\_files $uri $uri//index.html;


Location /appx4/{

Roots /home/dever/html/;

try\_files $uri $uri//appx4/index.html;


Location /tools/{

Root Root /home/dever/html;

index tools.html;



server {

Listen 2021;

\ server_name;


Roots /home/dever/html/adminweb4/;

try\_files $uri $uri//index.html;



  1. Reload the configuration file(/usr/local/nginx/sbin/nginx -s reload)

  2. Visit the website

  3. View logs

cat /usr/local/nginx/logs/error.log

  1. Server proxy settings

Location /briibio {

rewrite ^/api-v1(.\*)$$1 break;

Proxy Proxy__pass :8080;


Note:After the service proxy backend is configured, the frontend does not need to perform other proxy operations