banner
moeyy

moeyy

一条有远大理想的咸鱼。
github
mastodon
email

Baota + Cloud Lock Nginx Self-compiled Web Protection Tutorial

title: Tutorial on self-compiled web protection for Baota+YunSuo Nginx
tags:

  • YunSuo
  • Baota
    id: '120'
    categories:
    • Tutorial
      date: 2019-07-13 23:10:17
      cover:
      ai: true

This tutorial is written by the blogger after testing it personally, and it is shared with users who do not know how to compile the YunSuo Nginx module.

First of all, before proceeding with the operation, please make sure that the Baota panel has been configured properly and the Nginx environment has been configured using the compilation method! (Not the rapid installation, but the compilation installation)

Also, please backup the Nginx files properly and make sure that this tutorial is not applicable to non-Baota users and Apache users.

Secondly, as long as you follow this tutorial step by step, even a fool can compile it successfully. The official tutorial may confuse beginners, but this tutorial is not that complicated.

Configure the compilation environment. If Baota has already compiled Nginx, the environment should be configured by default, so you can ignore this step...

yum install -y gcc gcc-c++ pcre-devel openssl openssl-devel

You can use an SSH tool to log in with ROOT privileges and then download the backup Nginx, or you can directly use the command to backup Nginx.

Check the location of Nginx.

ps -elf  grep nginx

Enter the Baota Nginx directory.

cd /www/server/nginx/sbin/

Backup the Baota Nginx.

cp nginx nginx.bak

Enter the root directory.

cd /root

Download the YunSuo protection module zip file.

wget https://codeload.github.com/yunsuo-open/nginx-plugin/zip/master -O nginx-plugin-master.zip

Unzip the YunSuo protection module zip file.

unzip nginx-plugin-master.zip

Check the Nginx modules loaded by Baota's compilation. These modules still need to be loaded when recompiling and loading the YunSuo protection module.

nginx -V

Note that this command is uppercase "V". If it is lowercase "v", the modules will not be displayed.

Copy the content after "./configure arguents:" to a notepad for later use. For example, mine is:

--user=www --group=www --prefix=/www/server/nginx --with-openssl=/www/server/nginx/src/openssl --add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www/server/nginx/src/lua_nginx_module --add-module=/www/server/nginx/src/ngx_cache_purge --add-module=/www/server/nginx/src/nginx-sticky-module --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-http_concat_module --with-ld-opt=-Wl,-E --with-jemalloc --without-http_upstream_session_sticky_module --with-pcre=pcre-8.40

(Mine is for reference only, please refer to your own configuration)

Enter the Nginx source code directory and recompile Nginx. Before performing this operation, please confirm that your Nginx was installed in compilation mode, not the rapid installation of the Baota panel.

cd /www/server/nginx/src

Compilation content

./configure Content from the notepad in the previous step --add-module=/root/nginx-plugin-master

There is a space between "./configure" and the content copied from the notepad, and there is also a space before "--add-module". For example, my compilation command is:

./configure --user=www --group=www --prefix=/www/server/nginx --with-openssl=/www/server/nginx/src/openssl --add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www/server/nginx/src/lua_nginx_module --add-module=/www/server/nginx/src/ngx_cache_purge --add-module=/www/server/nginx/src/nginx-sticky-module --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-http_concat_module --with-ld-opt=-Wl,-E --with-jemalloc --without-http_upstream_session_sticky_module --with-pcre=pcre-8.40 --add-module=/root/nginx-plugin-master

(Mine is for reference only, please refer to your own configuration)

Wait for the command to finish, and then enter the compilation command.

make

After completion, replace the original Nginx in the system with the newly compiled Nginx file.

Stop Nginx.

service nginx stop

Delete the original Nginx. Please confirm that you have already backed up your Nginx before performing this operation.

rm -rf /www/server/nginx/sbin/nginx

Copy the newly compiled Nginx.

cp /www/server/nginx/src/objs/nginx /www/server/nginx/sbin/

Start Nginx.

service nginx start

Log in to YunSuo on the PC side, and after refreshing the PC side, you can see that the Nginx plugin has been recognized (changed from gray to green).

Enter your website URL followed by "/?order%20by" to test YunSuo.

image

Enable CAPTCHA to prevent CC attacks.

image

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.