Nginx 高级配置-第三方模块编译

                                       作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

  第三模块是对nginx 的功能扩展,第三方模块需要在编译安装Nginx 的时候使用参数--add-module=PATH指定路径添加,有的模块是由公司的开发人员针对业务需求定制开发的,有的模块是开源爱好者开发好之后上传到github进行开源的模块,nginx支持第三方模块需要从源码重新编译支持,比如开源的echo模块 https://github.com/openresty/echo-nginx-module.

一.配置echo模块相关功能

1>.查看编译安装nginx的相关参数

[root@node101.yinzhengjie.org.cn ~]# nginx -V
nginx version: nginx/1.14.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/yinzhengjie/softwares/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_modul
e --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module
[root@node101.yinzhengjie.org.cn ~]#

2>.主配置文件(生产环境中不建议更改主配置文件,因为在主配置文件中定义很多server会显得很臃肿,推荐在主配置文件中加载子配置文件将各个server分别放在不同的子配置文件中)

[root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/nginx/conf/nginx.conf
worker_processes 4;
worker_cpu_affinity 00000001 00000010 00000100 00001000; events {
worker_connections 100000;
use epoll;
accept_mutex on;
multi_accept on;
} http {
include mime.types;
default_type application/octet-stream;
sendfile on;
gzip on;
charset utf-8; #最大缓存10000个文件,非活动数据超时时长60s
open_file_cache max=10000 inactive=60s;
#每间隔60s检查一下缓存数据有效性
open_file_cache_valid 60s;
#60秒内至少被命中访问5次才被标记为活动数据
open_file_cache_min_uses 5;
#缓存错误信息
open_file_cache_errors on; #隐藏Nginx server版本。
server_tokens off; #当文件大于等于给定大小时,同步(直接)写磁盘,而非写缓存。
directio 4m; #上传文件相关参数
client_max_body_size 10m;
client_body_buffer_size 16k;
client_body_temp_path /yinzhengjie/data/web/nginx/temp 1 2 2; #IE系列的浏览器禁用长连接,默认就是禁用了IE的长连接功能.
keepalive_disable msie6; #开启长连接后,返回客户端的会话保持时间为60s,单次长连接累计请求达到指定次数请求或65秒就会被断开,后面的60为发送给客户端应答
报文头部中显示的超时时间设置为60s:如不设置客户端将不显示超时时间。 keepalive_timeout 65 60; #在一次长连接上所允许请求的资源的最大数量
keepalive_requests 3; #导入其他路径的配置文件
include /yinzhengjie/softwares/nginx/conf.d/*.conf;
} [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -t
nginx: the configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf test is successful
[root@node101.yinzhengjie.org.cn ~]#

3>.编辑echo的相关配置

[root@node101.yinzhengjie.org.cn ~]# cat -n /yinzhengjie/softwares/nginx/conf.d/share.conf
1 server {
2 listen 80;
3 server_name node101.yinzhengjie.org.cn;
4
5 location / {
6 root /yinzhengjie/data/web/nginx/static;
7 index index.html;
8 }
9
10 location /nginx_status {
11 stub_status;
12 allow 172.30.1.108;
13 deny all;
14 }
15
16 location /hello {
17 echo "hello, world!";
18 }
19 }
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -t      #如下所述,目前的nginx压根就不认识echo指令,因此我们需要停掉nginx服务并编译支持echo指令的相关模块。
nginx: [emerg] unknown directive "echo" in /yinzhengjie/softwares/nginx/conf.d/share.conf:17
nginx: configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf test failed
[root@node101.yinzhengjie.org.cn ~]#

4>.将echo指令端注释并停止nginx服务,编译支持echo指令的相关模块

[root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/nginx/conf.d/share.conf
server {
listen 80;
server_name node101.yinzhengjie.org.cn; location / {
root /yinzhengjie/data/web/nginx/static;
index index.html;
} location /nginx_status {
stub_status;
allow 172.30.1.108;
deny all;
} #location /hello {
# echo "hello, world!";
#}
}
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -t
nginx: the configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf test is successful
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 128 :::22 :::*
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -s stop
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 128 :::22 :::*
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#

二.编译支持echo指令的相关模块

1>.查看支持echo指令的github地址(https://github.com/openresty/echo-nginx-module)

2>.使用git命令将github的项目克隆到本地

[root@node101.yinzhengjie.org.cn ~]# yum -y install git
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirror.jdcloud.com
* updates: mirrors.huaweicloud.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.8.3.1-20.el7 will be installed
--> Processing Dependency: perl-Git = 1.8.3.1-20.el7 for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: rsync for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: perl(Term::ReadKey) for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: perl(Git) for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: perl(Error) for package: git-1.8.3.1-20.el7.x86_64
--> Running transaction check
---> Package perl-Error.noarch 1:0.17020-2.el7 will be installed
---> Package perl-Git.noarch 0:1.8.3.1-20.el7 will be installed
---> Package perl-TermReadKey.x86_64 0:2.30-20.el7 will be installed
---> Package rsync.x86_64 0:3.1.2-6.el7_6.1 will be installed
--> Finished Dependency Resolution Dependencies Resolved =================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================
Installing:
git x86_64 1.8.3.1-20.el7 base 4.4 M
Installing for dependencies:
perl-Error noarch 1:0.17020-2.el7 base 32 k
perl-Git noarch 1.8.3.1-20.el7 base 55 k
perl-TermReadKey x86_64 2.30-20.el7 base 31 k
rsync x86_64 3.1.2-6.el7_6.1 base 404 k Transaction Summary
=================================================================================================================================
Install 1 Package (+4 Dependent packages) Total download size: 4.9 M
Installed size: 23 M
Downloading packages:
(1/5): perl-Git-1.8.3.1-20.el7.noarch.rpm | 55 kB 00:00:00
(2/5): perl-Error-0.17020-2.el7.noarch.rpm | 32 kB 00:00:00
(3/5): rsync-3.1.2-6.el7_6.1.x86_64.rpm | 404 kB 00:00:00
(4/5): perl-TermReadKey-2.30-20.el7.x86_64.rpm | 31 kB 00:00:00
(5/5): git-1.8.3.1-20.el7.x86_64.rpm | 4.4 MB 00:00:01
---------------------------------------------------------------------------------------------------------------------------------
Total 2.9 MB/s | 4.9 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:perl-Error-0.17020-2.el7.noarch 1/5
Installing : rsync-3.1.2-6.el7_6.1.x86_64 2/5
Installing : perl-TermReadKey-2.30-20.el7.x86_64 3/5
Installing : git-1.8.3.1-20.el7.x86_64 4/5
Installing : perl-Git-1.8.3.1-20.el7.noarch 5/5
Verifying : perl-Git-1.8.3.1-20.el7.noarch 1/5
Verifying : 1:perl-Error-0.17020-2.el7.noarch 2/5
Verifying : perl-TermReadKey-2.30-20.el7.x86_64 3/5
Verifying : git-1.8.3.1-20.el7.x86_64 4/5
Verifying : rsync-3.1.2-6.el7_6.1.x86_64 5/5 Installed:
git.x86_64 0:1.8.3.1-20.el7 Dependency Installed:
perl-Error.noarch 1:0.17020-2.el7 perl-Git.noarch 0:1.8.3.1-20.el7 perl-TermReadKey.x86_64 0:2.30-20.el7
rsync.x86_64 0:3.1.2-6.el7_6.1 Complete!
[root@node101.yinzhengjie.org.cn ~]#

[root@node101.yinzhengjie.org.cn ~]# yum -y install git

[root@node101.yinzhengjie.org.cn ~]# cd /usr/local/src/
[root@node101.yinzhengjie.org.cn /usr/local/src]#
[root@node101.yinzhengjie.org.cn /usr/local/src]# ll
total 992
drwxr-xr-x 9 1001 1001 186 Dec 15 13:47 nginx-1.14.2
-rw-r--r-- 1 root root 1015384 Dec 4 2018 nginx-1.14.2.tar.gz
[root@node101.yinzhengjie.org.cn /usr/local/src]#
[root@node101.yinzhengjie.org.cn /usr/local/src]# git clone https://github.com/openresty/echo-nginx-module.git
Cloning into 'echo-nginx-module'...
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 3012 (delta 6), reused 7 (delta 3), pack-reused 2997
Receiving objects: 100% (3012/3012), 1.15 MiB | 473.00 KiB/s, done.
Resolving deltas: 100% (1617/1617), done.
[root@node101.yinzhengjie.org.cn /usr/local/src]#
[root@node101.yinzhengjie.org.cn /usr/local/src]# ll
total 992
drwxr-xr-x 6 root root 186 Dec 17 18:14 echo-nginx-module
drwxr-xr-x 9 1001 1001 186 Dec 15 13:47 nginx-1.14.2
-rw-r--r-- 1 root root 1015384 Dec 4 2018 nginx-1.14.2.tar.gz
[root@node101.yinzhengjie.org.cn /usr/local/src]#
[root@node101.yinzhengjie.org.cn /usr/local/src]#
[root@node101.yinzhengjie.org.cn /usr/local/src]# ll echo-nginx-module/
total 76
-rw-r--r-- 1 root root 3182 Dec 17 18:14 config
-rw-r--r-- 1 root root 1345 Dec 17 18:14 LICENSE
-rw-r--r-- 1 root root 54503 Dec 17 18:14 README.markdown
drwxr-xr-x 2 root root 4096 Dec 17 18:14 src
drwxr-xr-x 2 root root 4096 Dec 17 18:14 t
drwxr-xr-x 2 root root 55 Dec 17 18:14 util
-rw-r--r-- 1 root root 986 Dec 17 18:14 valgrind.suppress
[root@node101.yinzhengjie.org.cn /usr/local/src]#
[root@node101.yinzhengjie.org.cn /usr/local/src]# ll echo-nginx-module/src/          #很明显,都是C语言相关文件
total 184
-rw-r--r-- 1 root root 2494 Dec 17 18:14 ddebug.h
-rw-r--r-- 1 root root 8248 Dec 17 18:14 ngx_http_echo_echo.c
-rw-r--r-- 1 root root 758 Dec 17 18:14 ngx_http_echo_echo.h
-rw-r--r-- 1 root root 7689 Dec 17 18:14 ngx_http_echo_filter.c
-rw-r--r-- 1 root root 311 Dec 17 18:14 ngx_http_echo_filter.h
-rw-r--r-- 1 root root 4859 Dec 17 18:14 ngx_http_echo_foreach.c
-rw-r--r-- 1 root root 458 Dec 17 18:14 ngx_http_echo_foreach.h
-rw-r--r-- 1 root root 11397 Dec 17 18:14 ngx_http_echo_handler.c
-rw-r--r-- 1 root root 383 Dec 17 18:14 ngx_http_echo_handler.h
-rw-r--r-- 1 root root 4440 Dec 17 18:14 ngx_http_echo_location.c
-rw-r--r-- 1 root root 380 Dec 17 18:14 ngx_http_echo_location.h
-rw-r--r-- 1 root root 19729 Dec 17 18:14 ngx_http_echo_module.c
-rw-r--r-- 1 root root 4169 Dec 17 18:14 ngx_http_echo_module.h
-rw-r--r-- 1 root root 12268 Dec 17 18:14 ngx_http_echo_request_info.c
-rw-r--r-- 1 root root 1207 Dec 17 18:14 ngx_http_echo_request_info.h
-rw-r--r-- 1 root root 4628 Dec 17 18:14 ngx_http_echo_sleep.c
-rw-r--r-- 1 root root 435 Dec 17 18:14 ngx_http_echo_sleep.h
-rw-r--r-- 1 root root 22008 Dec 17 18:14 ngx_http_echo_subrequest.c
-rw-r--r-- 1 root root 612 Dec 17 18:14 ngx_http_echo_subrequest.h
-rw-r--r-- 1 root root 2122 Dec 17 18:14 ngx_http_echo_timer.c
-rw-r--r-- 1 root root 336 Dec 17 18:14 ngx_http_echo_timer.h
-rw-r--r-- 1 root root 6557 Dec 17 18:14 ngx_http_echo_util.c
-rw-r--r-- 1 root root 1533 Dec 17 18:14 ngx_http_echo_util.h
-rw-r--r-- 1 root root 2685 Dec 17 18:14 ngx_http_echo_var.c
-rw-r--r-- 1 root root 155 Dec 17 18:14 ngx_http_echo_var.h
[root@node101.yinzhengjie.org.cn /usr/local/src]#

[root@node101.yinzhengjie.org.cn /usr/local/src]# ll echo-nginx-module/

3>.编译安装nginx让其支持echo指令的(参考文档:https://github.com/openresty/echo-nginx-module#installation)

[root@node101.yinzhengjie.org.cn /usr/local/src]# nginx -V          #将配置参数的每一项都复制下来,一会要用来重新编译,这些参数最好都要一模一样。
nginx version: nginx/1.14.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/yinzhengjie/softwares/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stu
b_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module --add-module=/usr/local/src/echo-nginx-module
[root@node101.yinzhengjie.org.cn /usr/local/src]#
[root@node101.yinzhengjie.org.cn /usr/local/src]#
[root@node101.yinzhengjie.org.cn /usr/local/src]# cd nginx-1.14.2/
[root@node101.yinzhengjie.org.cn /usr/local/src/nginx-1.14.2]#
[root@node101.yinzhengjie.org.cn /usr/local/src/nginx-1.14.2]# ./configure --prefix=/yinzhengjie/softwares/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module --add-module=/usr/local/src/echo-nginx-module
......
[root@node101.yinzhengjie.org.cn /usr/local/src/nginx-1.14.2]# echo $?
0
[root@node101.yinzhengjie.org.cn /usr/local/src/nginx-1.14.2]#
[root@node101.yinzhengjie.org.cn /usr/local/src/nginx-1.14.2]# make -j 4
......
[root@node101.yinzhengjie.org.cn /usr/local/src/nginx-1.14.2]# echo $?
0
[root@node101.yinzhengjie.org.cn /usr/local/src/nginx-1.14.2]#
[root@node101.yinzhengjie.org.cn /usr/local/src/nginx-1.14.2]# make install
......
[root@node101.yinzhengjie.org.cn /usr/local/src/nginx-1.14.2]# echo $?
0
[root@node101.yinzhengjie.org.cn /usr/local/src/nginx-1.14.2]#

三.继续配置第三方模块echo指令

1>.修改子配置文件,将之前注释的echo指令代码取消,检查语法通过,说明echo指令的相关模块编译成功

[root@node101.yinzhengjie.org.cn ~]# vim /yinzhengjie/softwares/nginx/conf.d/share.conf
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/nginx/conf.d/share.conf
server {
listen 80;
server_name node101.yinzhengjie.org.cn; location / {
root /yinzhengjie/data/web/nginx/static;
index index.html;
} location /nginx_status {
stub_status;
allow 172.30.1.108;
deny all;
} location /hello {
echo "hello, world!";
}
}
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -t
nginx: the configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf test is successful
[root@node101.yinzhengjie.org.cn ~]#

2>.启动nginx

[root@node101.yinzhengjie.org.cn ~]# ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 128 :::22 :::*
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 128 :::22 :::*
[root@node101.yinzhengjie.org.cn ~]#

3>.浏览器访问定义echo指令的相关URL,发现文件被下载下来了(因为我们没有指定相关的MIME类型),如下图所示

4>.继续修改nginx的子配置文件,并指定默认的MIME类型为文本类型

[root@node101.yinzhengjie.org.cn ~]# vim /yinzhengjie/softwares/nginx/conf.d/share.conf
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/nginx/conf.d/share.conf
server {
listen 80;
server_name node101.yinzhengjie.org.cn; location / {
root /yinzhengjie/data/web/nginx/static;
index index.html;
} location /nginx_status {
stub_status;
allow 172.30.1.108;
deny all;
} location /hello {
default_type text/html;
echo "hello, world!";
}
}
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -t
nginx: the configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf test is successful
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -s reload
[root@node101.yinzhengjie.org.cn ~]#

5>.指定默认的MIME类型后,再次访问"http://node101.yinzhengjie.org.cn/hello",如下图所示。

四.在一个location中调用其它location的案例

1>.编辑子配置文件

[root@node101.yinzhengjie.org.cn ~]# vim /yinzhengjie/softwares/nginx/conf.d/share.conf
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/nginx/conf.d/share.conf
server {
listen 80;
server_name node101.yinzhengjie.org.cn; location / {
root /yinzhengjie/data/web/nginx/static;
index index.html;
} location /nginx_status {
stub_status;
allow 172.30.1.108;
deny all;
} location /main {
index index.html;
default_type text/html;
echo "hello world,main-->";
echo_reset_timer;
echo_location /sub1;
echo_location /sub2;
echo "took $echo_timer_elapsed sec for total.";
} location /sub1 {
echo_sleep 1;
echo sub1;
} location /sub2 {
echo_sleep 1;
echo sub2;
} }
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -t
nginx: the configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf test is successful
[root@node101.yinzhengjie.org.cn ~]#

2>.重新加载配置文件

[root@node101.yinzhengjie.org.cn ~]# ps -ef | grep nginx | grep -v grep
root 9297 1 0 18:30 ? 00:00:00 nginx: master process nginx
nginx 9372 9297 0 18:36 ? 00:00:00 nginx: worker process
nginx 9373 9297 0 18:36 ? 00:00:00 nginx: worker process
nginx 9374 9297 0 18:36 ? 00:00:00 nginx: worker process
nginx 9375 9297 0 18:36 ? 00:00:00 nginx: worker process
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -s reload
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ps -ef | grep nginx | grep -v grep
root 9297 1 0 18:30 ? 00:00:00 nginx: master process nginx
nginx 9405 9297 5 18:46 ? 00:00:00 nginx: worker process
nginx 9406 9297 5 18:46 ? 00:00:00 nginx: worker process
nginx 9407 9297 6 18:46 ? 00:00:00 nginx: worker process
nginx 9408 9297 9 18:46 ? 00:00:00 nginx: worker process
[root@node101.yinzhengjie.org.cn ~]#

3>.浏览器访问"http://node101.yinzhengjie.org.cn/main",最终结果如下图所示

Nginx 高级配置-第三方模块编译的更多相关文章

  1. Nginx网络架构实战学习笔记(四):nginx连接memcached、第三方模块编译及一致性哈希应用

    文章目录 nginx连接memcached 第三方模块编译及一致性哈希应用 总结 nginx连接memcached 首先确保nginx能正常连接php location ~ \.php$ { root ...

  2. Nginx 高级配置-https 功能

    Nginx 高级配置-https 功能 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.HTTPS工作过程 1>.SSL/TLS SSL(Secure Socket Lay ...

  3. Nginx 高级配置-状态页配置

    Nginx 高级配置-状态页配置 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 建议将nginx的监控状态的值通过zabbix或者Open-Falcon之类的监控工具来监控状态,并 ...

  4. Nginx 高级配置-压缩功能

    Nginx 高级配置-压缩功能 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.Nginx压缩相关参数概述 1>.gzip on | off; Nginx支持对指定类型的文 ...

  5. Nginx 高级配置-自定义json格式日志

    Nginx 高级配置-自定义json格式日志 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 在大数据运维工作中,我们经常会使用flume,filebeat相关日志收集工具取收集日志 ...

  6. Nginx 高级配置-变量使用

    Nginx 高级配置-变量使用 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任.  nginx的变量可以在配置文件中引用,作为功能判断或者日志等场景使用,变量可以分为内置变量和自定义变 ...

  7. Nginx 高级配置--关于favicon.ico

    Nginx 高级配置--关于favicon.ico 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.浏览器会默认帮咱们访问官网的图标 1>.浏览器访问网站"htt ...

  8. Nginx 高级配置-实现多域名HTTPS

    Nginx 高级配置-实现多域名HTTPS 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.Nginx支持基于单个IP实现多域名的功能 Nginx支持基于单个IP实现多域名的功能 ...

  9. 玩玩 Nginx 2-----给Nginx添加第三方模块(动态更新upstream)

          接上一篇,我们在初始化安装的时候添加了nginx_lua模块,然后了解到nginx不可以动态加载模块,所以当你安装第三方模块的时候需要覆盖nginx文件.接下来一起看看如何安装nginx第 ...

随机推荐

  1. 【java】[null]的问题

    这么写逻辑就有问题,改成下面的

  2. [LeetCode] 892. Surface Area of 3D Shapes 三维物体的表面积

    On a N * N grid, we place some 1 * 1 * 1 cubes. Each value v = grid[i][j] represents a tower of v cu ...

  3. [原创]浅谈在创业公司对PMF的理解

    [原创]浅谈在创业公司对PMF的理解 在创业时,大多数人都常谈一个词叫"MVP“,但PMF谈的比较少,PMF在创业公司尤为重要,以下谈谈个人一些看法. 1.什么是PMF? 创业公司:一种是找 ...

  4. .NET Core:Api版本控制

    (1)先安装Microsoft.AspNetCore.Mvc.Versioning (2)在Startup的ConfigureServices方法中加入:services.AddApiVersioni ...

  5. HTTP之缓存处理步骤

    缓存的处理步骤 =================摘自<HTTP权威指南>===================== 现代的商业化代理缓存相当的复杂.这些缓存构建的非常有效,可以支持HTT ...

  6. golang net之http server

    golang 版本:1.12.9 简单的HTTP服务器代码: package main import ( "net/http" ) type TestHandler struct ...

  7. 基于FlexBox的无约束自适应

    全手打原创,转载请标明出处:https://www.cnblogs.com/dreamsqin/p/11972664.html,多谢,=.=~ 一.背景描述   对于通用型带过滤条件的列表查询项目中, ...

  8. 【09】Jenkins:Pipeline 补充

    写在前面的话 我们在使用普通的构建任务的时候使用了 Sonar 做代码质量管理,也使用了 Publish Over SSH 插件中更新上线,但是我们在 Pipeline 怎么使用他们呢. 如果你没有查 ...

  9. 《 .NET并发编程实战》阅读指南 - 第14章

    先发表生成URL以印在书里面.等书籍正式出版销售后会公开内容.    

  10. 2019-11-29-C#-通过编程的方法在桌面创建回收站快捷方式

    原文:2019-11-29-C#-通过编程的方法在桌面创建回收站快捷方式 title author date CreateTime categories C# 通过编程的方法在桌面创建回收站快捷方式 ...