" />

Nginx高级配置

2024/5/5 20:18:42

1 nginx状态页

在编译的时候需要添加--with-http_stub_status_module参数
配置案例:
[root@CentOS7-01 ~]#cat /apps/nginx/conf/vhosts/pc.conf 
server {listen 80;server_name www.hechunping.tech;location /nginx_status {stub_status;allow 192.168.7.0/24;allow 127.0.0.1;deny all;}
}
[root@CentOS7-01 ~]#systemctl reload nginx访问测试
[root@CentOS7-01 ~]#curl www.hechunping.tech/nginx_status
Active connections: 1 
server accepts handled requests32 32 36  #这三个数字分别对应accepts,handled,requests三个值
Reading: 0 Writing: 1 Waiting: 0 相关解释:
Active connections: 当前处于活动状态的客户端连接数,包括连接等待空闲连接数。
accepts: 统计总值,Nginx⾃启动后已经接受的客户端请求的总数。
handled: 统计总值,Nginx⾃启动后已经处理完成的客户端请求的总数,通常等于accepts,除⾮有因worker_connections限制等被拒绝的连接。
requests:统计总值,Nginx⾃启动后客户端发来的总的请求数。
Reading: 当前状态,正在读取客户端请求报⽂⾸部的连接的连接数。
Writing: 当前状态,正在向客户端发送响应报⽂过程中的连接数。
Waiting: 当前状态,正在等待客户端发出请求的空闲连接数,开启 keep-alive的情况下,这个值等于 active – (reading+writing)。

2 nginx编译的时候添加第三方模块

第三模块是对nginx的功能扩展,第三⽅模块需要在编译安装Nginx的时候使⽤参数--add-module=PATH指定路径添加,有的模块是由公司的开发⼈员针对业务需求定制开发的,有的模块是开源爱好者开发好之后上传到github进⾏开源的模块,nginx⽀持第三⽅模块需要从源码重新编译⽀持,⽐如开源的echo模块 https://github.com/openresty/echo-nginx-module配置案例
[root@CentOS7-01 ~]#cat /apps/nginx/conf/vhosts/pc.conf 
server {listen 80;server_name www.hechunping.tech;location /pc {echo_sleep 1;echo "this is pc directory";}
}
[root@CentOS7-01 ~]#nginx -t
nginx: [emerg] unknown directive "echo_sleep" in /apps/nginx/conf/vhosts/pc.conf:5
nginx: configuration file /apps/nginx/conf/nginx.conf test failed
[root@CentOS7-01 ~]#yum install git -y
[root@CentOS7-01 ~]#git clone https://github.com/openresty/echo-nginx-module.git
[root@CentOS7-01 ~]#systemctl stop nginx
[root@CentOS7-01 ~]#cd nginx-1.16.1/
[root@CentOS7-01 nginx-1.16.1]#./configure --prefix=/apps/nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module  \
--with-http_image_filter_module \
--with-http_geoip_module \
--with-http_gunzip_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@CentOS7-01 nginx-1.16.1]#make -j lscpu |awk 'NR==4{print $2}' && make install# 再次检测语法,正常
[root@CentOS7-01 nginx-1.16.1]#nginx -t
nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
[root@CentOS7-01 nginx-1.16.1]#nginx -V
nginx version: nginx/1.16.1
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=/apps/nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_geoip_module --with-http_gunzip_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@CentOS7-01 nginx-1.16.1]#systemctl start nginx# 访问测试,echo模块已经可用
[root@CentOS7-01 nginx-1.16.1]#curl www.hechunping.tech/pc
this is pc directory

3 nginx变量使用

nginx的变量可以在配置⽂件中引⽤,作为功能判断或者⽇志等场景使⽤,变量可以分为内置变量和⾃定义变量,
内置变量是由nginx模块⾃带,通过变量可以获取到众多的与客⼾端访问相关的值。

3.1 内置变量

可以通过上面的echo模块输出,下面的变量都是参照如下配置文件
[root@CentOS7-01 nginx-1.16.1]#cat /apps/nginx/conf/vhosts/pc.conf 
server {listen 80;server_name www.hechunping.tech;location /pc {echo $remote_addr;}
}$remote_addr; #存放了客户端的地址,注意是客户端的公⽹IP,也就是⼀家⼈访问⼀个⽹站,则会显⽰为路由器的公⽹IP。
[root@CentOS7-01 nginx-1.16.1]#curl www.hechunping.tech/pc
127.0.0.1$args; #变量中存放了URL中的指令,例如http://www.hechunping.tech/pc/index.do?id=20200105
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc/index.do?id=20200105
id=20200105$document_root; #保存了针对当前资源的请求的系统根⽬录
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
/apps/nginx/html$document_uri; #保存了当前请求中不包含指令的URI,注意是不包含请求的指令,比如
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc/index.do?id=20200105
/pc/index.do$host; #存放了请求的host名称。
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
www.hechunping.tech$http_user_agent; #客⼾端浏览器的详细信息
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
curl/7.29.0$http_cookie; #客⼾端的cookie信息。$limit_rate; #如果nginx服务器使⽤limit_rate配置了显⽰⽹络速率,则会显⽰,如果没有设置,则显⽰0。
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
0$remote_port; #客⼾端请求Nginx服务器时随机打开的端⼝,这是每个客⼾端⾃⼰的端⼝。
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
37848
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
37850$remote_user; #已经经过Auth Basic Module验证的⽤⼾名。$request_body_file; #做反向代理时发给后端服务器的本地资源的名称。$request_method; #请求资源的⽅式,GET/PUT/DELETE等
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
GET$request_filename; #当前请求的资源⽂件的路径名称,由root或alias指令与URI请求⽣成的⽂件绝对路径,如
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc/index.html
/apps/nginx/html/pc/index.html$request_uri; #包含请求参数的原始URI,不包含主机名,如
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc/index.do?id=20200105
/pc/index.do?id=20200105$scheme; #请求的协议,如ftp,https,http等。
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
http$server_protocol; #保存了客⼾端请求资源使⽤的协议的版本,如HTTP/1.0,HTTP/1.1,HTTP/2.0等。
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
HTTP/1.1$server_addr; #保存了服务器的IP地址。
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
127.0.0.1$server_name; #请求的服务器的主机名。
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
www.hechunping.tech$server_port; #请求的服务器的端⼝号。
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
80

3.2 自定义变量

假如需要⾃定义变量名称和值,使⽤指令"set $variable value;",语法如下
Syntax: set $variable value;
Default:    —
Context:    server, location, if配置
[root@CentOS7-01 ~]#cat /apps/nginx/conf/vhosts/pc.conf 
server {listen 80;server_name www.hechunping.tech;location /pc {set $name $server_name;echo $name;set $my_port $server_port;echo $my_port;}
}
[root@CentOS7-01 ~]#!s
systemctl restart nginx访问测试
[root@CentOS7-01 ~]#curl http://www.hechunping.tech/pc
www.hechunping.tech
80

4 nginx自定义访问日志

访问⽇志是记录客户端即⽤户的具体请求内容信息,全局配置模块中的error_log是记录nginx服务器运⾏时的⽇志
保存路径和记录⽇志的level,因此有着本质的区别,⽽且Nginx的错误⽇志⼀般只有⼀个,但是访问⽇志可以在不
同server中定义多个,定义⼀个⽇志需要使⽤access_log指定⽇志的保存路径,使⽤log_format指定⽇志的格式,
格式中定义要保存的具体⽇志内容。

4.1 自定义默认格式日志

如果是要保留⽇志的原格式,只是添加相应的⽇志内容,则配置如下:log_format  www.hechunping.tech  '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"''$server_name:$server_port';access_log /data/nginx/logs/www.hechunping.tech/access.log www.hechunping.tech;[root@CentOS7-01 ~]#nginx -t
nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
[root@CentOS7-01 ~]#systemctl reload nginx
[root@CentOS7-01 ~]#tail -f /data/nginx/logs/www.hechunping.tech/access.log 
192.168.7.1 - - [05/Jan/2020:14:58:47 +0800] "GET /pc/ HTTP/1.1" 200 7 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36" "-"www.hechunping.tech:80

4.2 自定义json格式日志

Nginx 的默认访问⽇志记录内容相对⽐较单⼀,默认的格式也不⽅便后期做⽇志统计分析,⽣产环境中通常将nginx⽇志转换为json⽇志,然后配合使⽤ELK做⽇志收集-统计-分析。log_format access_json '{"@timestamp":"$time_iso8601",''"host":"$server_addr",''"clientip":"$remote_addr",''"size":$body_bytes_sent,''"responsetime":$request_time,''"upstreamtime":"$upstream_response_time",''"upstreamhost":"$upstream_addr",''"http_host":"$host",''"uri":"$uri",''"domain":"$host",''"xff":"$http_x_forwarded_for",''"referer":"$http_referer",''"tcp_xff":"$proxy_protocol_addr",''"http_user_agent":"$http_user_agent",''"status":"$status"}';access_log /data/nginx/logs/www.hechunping.tech/access.log access_json;[root@CentOS7-01 ~]#tail -f /data/nginx/logs/www.hechunping.tech/access.log
{"@timestamp":"2020-01-05T15:04:16+08:00","host":"192.168.7.71","clientip":"192.168.7.1","size":7,"responsetime":0.000,"upstreamtime":"-","upstreamhost":"-","http_host":"www.hechunping.tech","uri":"/pc/index.html","domain":"www.hechunping.tech","xff":"-","referer":"-","tcp_xff":"","http_user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36","status":"200"}

4.3 用Python统计json格式的访问日志

[root@CentOS7-01 ~]#cat nginx_json.py
#!/usr/bin/env python
#coding:utf-8
status_200 = []
status_404 = []
with open("access_json.log") as f:for line in f.readlines():line = eval(line)if line.get("status") == "200":status_200.append(line.get)                                                                                                                                    elif line.get("status") == "404":status_404.append(line.get)else:print("状态码 ERROR")
f.close()
print "状态码为200的有-->:",len(status_200)
print "状态码为404的有-->:",len(status_404)[root@CentOS7-01 ~]#python nginx_json.py
...
状态码 ERROR
状态码为200的有-->: 403428
状态码为404的有-->: 125712

5 nginx压缩功能

Nginx⽀持对指定类型的⽂件进⾏压缩然后再传输给客⼾端,⽽且压缩还可以设置压缩⽐例,压缩后的⽂件⼤⼩将⽐源⽂件显著变⼩,这样有助于降低出⼝带宽的利⽤率,降低企业的IT⽀出,不过会占⽤相应的CPU资源。
Nginx对⽂件的压缩功能是依赖于模块ngx_http_gzip_module,官⽅⽂档: https://nginx.org/en/docs/http/ngx_http_gzip_module.html, 配置指令如下:gzip on | off; #启⽤或禁⽤gzip压缩,默认关闭
gzip_comp_level level; #压缩⽐由低到⾼从1到9,默认为1
gzip_disable "MSIE [1-6]\."; #禁⽤IE6 gzip功能
gzip_min_length 1k; #gzip压缩的最⼩⽂件,⼩于设置值的⽂件将不会压缩
gzip_http_version 1.0 | 1.1; #启⽤压缩功能时,协议的最⼩版本,默认HTTP/1.1
gzip_buffers number size; #指定Nginx服务需要向服务器申请的缓存空间的个数*⼤⼩,默认32 4k|16 8k;
gzip_types mime-type ...; #指明仅对哪些类型的资源执⾏压缩操作;默认为gzip_types text/html,不⽤显⽰指定,否则出错
gzip_vary on | off; #如果启⽤压缩,是否在响应报⽂⾸部插⼊"Vary: Accept-Encoding"配置案例gzip on;gzip_comp_level 5;gzip_min_length 1k;    gzip_types text/plain application/javascript application/x-javascript text/cssapplication/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;  gzip_vary on;[root@CentOS7-01 ~]#cat /apps/nginx/conf/vhosts/pc.conf 
server {listen 80;server_name www.hechunping.tech;location /pc {root html;}
}
[root@CentOS7-01 ~]#ll /apps/nginx/html/pc/test.html -h
-rw-r--r-- 1 nginx nginx 1.7M Jan  5 16:01 /apps/nginx/html/pc/test.html #使用该文件进行压缩测试访问测试,压缩后的大小

Nginx高级配置
Nginx高级配置

6 https功能

6.1 ssl配置参数

nginx的https功能基于模块ngx_http_ssl_module实现,因此如果是编译安装的nginx要使⽤参数--with-http_ssl_module开启ssl功能,但是作为nginx的核⼼功能,yum安装的nginx默认就是开启的。
官⽅⽂档: https://nginx.org/en/docs/http/ngx_http_ssl_module.html配置参数如下:
ssl on | off; #为指定的虚拟主机配置是否启⽤ssl功能,此功能在1.15.0废弃,使⽤listen [ssl]替代。ssl_certificate /path/to/file; #当前虚拟主机使⽤使⽤的公钥⽂件,⼀般是crt⽂件ssl_certificate_key /path/to/file; #当前虚拟主机使⽤的私钥⽂件,⼀般是key⽂件ssl_protocols [SSLv2] [SSLv3] [TLSv1] [TLSv1.1] [TLSv1.2]; #⽀持ssl协议版本,早期为ssl,现在是TSL,默认为后三个ssl_session_cache off | none | [builtin[:size]] [shared:name:size]; #配置ssl缓存
off: 关闭缓存
none: 通知客⼾端⽀持ssl session cache,但实际不⽀持
builtin[:size]: 使⽤OpenSSL内建缓存,为每worker进程私有
[shared:name:size]: 在各worker之间使⽤⼀个共享的缓存,需要定义⼀个缓存名称和缓存空间⼤⼩,⼀兆可以存储4000个会话信息,多个虚拟主机可以使⽤相同的缓存名称。ssl_session_timeout time; #客⼾端连接可以复⽤ssl session cache中缓存的有效时⻓,默认5m

6.2 自签名证书

# 自签名CA证书
[root@CentOS7-01 ~]#cd /apps/nginx/
[root@CentOS7-01 nginx]#mkdir certs
[root@CentOS7-01 nginx]#cd certs
[root@CentOS7-01 certs]#openssl req -newkey rsa:4096 -nodes -sha256 -keyout ca.key -x509 -days 3650 -out ca.crt
Generating a 4096 bit RSA private key
......++
...................++
writing new private key to 'ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN #国家代码,参看:https://country-code.cl
State or Province Name (full name) []:BeiJing  #省份
Locality Name (eg, city) [Default City]:BeiJing #城市名称
Organization Name (eg, company) [Default Company Ltd]:abc #公司名称
Organizational Unit Name (eg, section) []:IT #部门名称
Common Name (eg, your name or your server's hostname) []:hechunping #通用名称
Email Address []:742384103@qq.com #邮箱
[root@CentOS7-01 certs]#ls
ca.crt  ca.key# 自制key和csr文件
[root@CentOS7-01 certs]#openssl req -newkey rsa:4096 -nodes -sha256 -keyout www.hechunping.tech.key -out www.hechunping.tech.csr
Generating a 4096 bit RSA private key
...............................................++
........................................................................................++
writing new private key to 'www.hechunping.tech.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:BeiJing
Locality Name (eg, city) [Default City]:BeiJing 
Organization Name (eg, company) [Default Company Ltd]:abc
Organizational Unit Name (eg, section) []:IT
Common Name (eg, your name or your server's hostname) []:hechunping
Email Address []:742384103@qq.comPlease enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:  #此处为空即可
An optional company name []: #同上
[root@CentOS7-01 certs]#ll
total 16
-rw-r--r-- 1 root root 2090 Jan  5 21:05 ca.crt
-rw-r--r-- 1 root root 3272 Jan  5 21:05 ca.key
-rw-r--r-- 1 root root 1736 Jan  5 21:11 www.hechunping.tech.csr
-rw-r--r-- 1 root root 3272 Jan  5 21:11 www.hechunping.tech.key# 签发证书
[root@CentOS7-01 certs]#openssl x509 -req -days 3650 -in www.hechunping.tech.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out www.hechunping.tech.crt
Signature ok
subject=/C=CN/ST=BeiJing/L=BeiJing/O=abc/OU=IT/CN=hechunping/emailAddress=742384103@qq.com
Getting CA Private Key# 验证证书内容
[root@CentOS7-01 certs]#openssl x509 -in www.hechunping.tech.crt -noout -text
Certificate:Data:Version: 1 (0x0)Serial Number:c6:bd:85:07:5d:3c:bc:54Signature Algorithm: sha256WithRSAEncryptionIssuer: C=CN, ST=BeiJing, L=BeiJing, O=abc, OU=IT, CN=hechunping/emailAddress=742384103@qq.comValidityNot Before: Jan  5 13:13:08 2020 GMTNot After : Jan  2 13:13:08 2030 GMTSubject: C=CN, ST=BeiJing, L=BeiJing, O=abc, OU=IT, CN=hechunping/emailAddress=742384103@qq.comSubject Public Key Info:Public Key Algorithm: rsaEncryptionPublic-Key: (4096 bit)
......

6.3 nginx证书配置

[root@CentOS7-01 certs]#cat /apps/nginx/conf/vhosts/pc.conf 
server {listen 80;listen 443 ssl;ssl_certificate /apps/nginx/certs/www.hechunping.tech.crt;ssl_certificate_key /apps/nginx/certs/www.hechunping.tech.key;ssl_session_cache shared:sslcache:20m;ssl_session_timeout 10m;server_name www.hechunping.tech;location /pc {root html;}
}
[root@CentOS7-01 certs]#systemctl reload nginx
访问测试

Nginx高级配置

6.4 实现多域名HTTPS

Nginx⽀持基于单个IP实现多域名的功能,并且还⽀持单IP多域名的基础之上实现HTTPS,其实是基于Nginx的SNI(Server Name Indication)功能实现,SNI是为了解决⼀个Nginx服务器内使⽤⼀个IP绑定多个域名和证书的功能,其具体功能是客⼾端在连接到服务器建⽴SSL链接之前先发送要访问站点的域名(Hostname),这样服务器再根据这个域名返回给客⼾端⼀个合适的证书。# 制作key和csr文件
[root@CentOS7-01 certs]#openssl req -newkey rsa:4096 -nodes -sha256 -keyout news.hechunping.tech.key -out news.hechunping.tech.csr
Generating a 4096 bit RSA private key
.............................................................................++
.....................................................................................................................................................................................................................................................................................................++
writing new private key to 'news.hechunping.tech.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:BeiJing
Locality Name (eg, city) [Default City]:BeiJing
Organization Name (eg, company) [Default Company Ltd]:xyz
Organizational Unit Name (eg, section) []:IT
Common Name (eg, your name or your server's hostname) []:hechunping
Email Address []:742384103@qq.comPlease enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:# 签名证书
[root@CentOS7-01 certs]#openssl x509 -req -days 3650 -in news.hechunping.tech.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out news.hechunping.tech.crt
Signature ok
subject=/C=CN/ST=BeiJing/L=BeiJing/O=xyz/OU=IT/CN=hechunping/emailAddress=742384103@qq.com
Getting CA Private Key# 验证证书内容
[root@CentOS7-01 certs]#openssl x509 -in news.hechunping.tech.crt -noout -text
Certificate:Data:Version: 1 (0x0)Serial Number:c6:bd:85:07:5d:3c:bc:55Signature Algorithm: sha256WithRSAEncryptionIssuer: C=CN, ST=BeiJing, L=BeiJing, O=abc, OU=IT, CN=hechunping/emailAddress=742384103@qq.comValidityNot Before: Jan  5 13:52:00 2020 GMTNot After : Jan  2 13:52:00 2030 GMTSubject: C=CN, ST=BeiJing, L=BeiJing, O=xyz, OU=IT, CN=hechunping/emailAddress=742384103@qq.comSubject Public Key Info:Public Key Algorithm: rsaEncryptionPublic-Key: (4096 bit)
......# nginx配置证书
[root@CentOS7-01 certs]#cat /apps/nginx/conf/vhosts/news.conf 
server {listen 80;listen 443 ssl;ssl_certificate /apps/nginx/certs/news.hechunping.tech.crt;ssl_certificate_key /apps/nginx/certs/news.hechunping.tech.key;ssl_session_cache shared:sslcache:20m;ssl_session_timeout 10m;server_name news.hechunping.tech;location /pc {root html;}
}
[root@CentOS7-01 certs]#systemctl reload nginx# 访问测试

Nginx高级配置

7 关于favicon.ico

favicon.ico ⽂件是浏览器收藏⽹址时显⽰的图标,当客⼾端使⽤浏览器问⻚⾯时,浏览器会⾃⼰主动发起请求获取⻚⾯的favicon.ico⽂件,但是当浏览器请求的favicon.ico⽂件不存在时,服务器会记录404⽇志,⽽且浏览器也会显⽰404报错。解决方法
将图标保存到指定的目录
[root@CentOS7-01 ~]#cat /apps/nginx/conf/vhosts/pc.conf 
server {listen 80;server_name www.hechunping.tech;location = /favicon.ico {root html/image;}location /pc {root html;}
}
[root@CentOS7-01 ~]#systemctl reload nginx

Nginx高级配置
Nginx高级配置

8 安全选项

8.1 隐藏nginx版本号

更改nginx源码信息,将nginx服务版本号更改为HCPWS/1.1并重新编译nginx
[root@CentOS7-01 nginx-1.16.1]#sed -ir 's#Server: nginx#Server: HCPWS/1.1#' /root/nginx-1.16.1/src/http/ngx_http_header_filter_module.c
[root@CentOS7-01 nginx-1.16.1]#nginx -V
nginx version: nginx/1.16.1
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=/apps/nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_geoip_module --with-http_gunzip_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@CentOS7-01 nginx-1.16.1]#./configure --prefix=/apps/nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_geoip_module --with-http_gunzip_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@CentOS7-01 nginx-1.16.1]#make -j lscpu | awk 'NR==4{print $2}' && make install
[root@CentOS7-01 nginx-1.16.1]#systemctl restart nginx
访问测试

Nginx高级配置

8.2 升级Openssl版本

⼼脏出⾎(英语:Heartbleed),也简称为⼼⾎漏洞,是⼀个出现在加密程序库OpenSSL的安全漏洞,该程序库⼴泛⽤于实现互联⽹的传输层安全(TLS)协议。它于2012年被引⼊了软件中,2014年4⽉⾸次向公众披露。只要使⽤的是存在缺陷的OpenSSL实例,⽆论是服务器还是客⼾端,都可能因此⽽受到***。此问题的原因是在实现TLS的⼼跳扩展时没有对输⼊进⾏适当验证(缺少边界检查),因此漏洞的名称来源于“⼼跳”(heartbeat)。该程序错误属于缓冲区过读,即可以读取的数据⽐应该允许读取的还多。升级步骤
1)查看当前的Openssl版本

Nginx高级配置

2)下载OpenSSL源码包并解压
[root@CentOS7-01 nginx-1.16.1]#wget -P /usr/local/src/ https://www.openssl.org/source/openssl-1.1.1d.tar.gz
[root@CentOS7-01 nginx-1.16.1]#tar xf /usr/local/src/openssl-1.1.1d.tar.gz 
3)编译安装nginx并指定新版本OpenSSL路径
[root@CentOS7-01 nginx-1.16.1]#nginx -V
nginx version: nginx/1.16.1
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=/apps/nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_geoip_module --with-http_gunzip_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@CentOS7-01 nginx-1.16.1]#./configure --prefix=/apps/nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_geoip_module --with-http_gunzip_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 --with-openssl=./openssl-1.1.1d
[root@CentOS7-01 nginx-1.16.1]#make -j lscpu |awk 'NR==4{print $2}' && make install
[root@CentOS7-01 nginx-1.16.1]#systemctl restart nginx
验证

Nginx高级配置

查看全文
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

相关文章

  1. 每天自动备份Oracle数据库

    本文以CentOS 7.6系统与Oracle 11g为例,教你如何在Linux下设置每天自动备份Oracle数据库。一.先找到数据库的环境变量如果是在root账户下,须先登录到数据库所在账户su oracle cat ~/.bash_profileexport PATH export ORACLE_BASE=/home/nnc_db/app export ORACLE_HOME=$ORACL…...

    2024/5/5 19:32:01
  2. 通过ks.cfg文件自动安装系统

    最近需要制作自动安装系统的iso镜像文件,写个笔记以防忘记第一步、拿到iso原始文件,我用的是rhel7.7的把rhel7.7文件复制出来到一个目录中第二步、编写一个名字叫ks.cfg文件内容如下:#version=DEVEL Install OS instead of upgrade install Keyboard layouts keyboard us Ro…...

    2024/4/16 15:29:51
  3. 九析带你玩转 linux 系列

    目录本系列文章:第一章:九析带你玩转 linux - 内核升级篇第二章:九析带你玩转 linux - vagrant 安装篇第三章:九析带你玩转 linux - 僵尸进程(zombie)第四章:九析带你玩转 linux - 自建 DNS第五章:九析带你玩转 linux - tcpdump第六章:九析带你玩转 linux - bash第七章…...

    2024/4/16 15:29:41
  4. Linux安装nginx教程

    #系统选择:centos6.6 一、添加nginx服务进程用户 groupadd -r nginxuseradd -r -g nginx nginx 二、下载并解压安装包 wget http://nginx.org/download/nginx-1.9.9.tar.gztar xvf nginx-1.9.9.tar.gz -C /usr/local/src 三、安装相应开发者工具 yum groupinstall "Deve…...

    2024/4/24 8:26:23
  5. Nginx安装、实现反向代理及深度优化

    一、Nginx的安装关于Nginx的基本概念,在之前的博文中:https://blog.51cto.com/14227204/2464167有详细的介绍,这篇博文就直接从安装开始谈起。环境准备:三台centos 7.5,其中一台运行Nginx,另外两台运行简单的web服务即可,主要用来测试Nginx反向代理的效果; 下载我提供的…...

    2024/4/24 8:26:22
  6. k8s 小实验nginx+php

    1.配置nfs 存储卷 yum -y install nfs-utils rpcbind##安装nfs服务和RPC服务vim /etc/exports #nfs的配置文件/data/v1 10.1.1.0/24(rw,no_root_squash,no_all_squash,sync)#给10.1.1.0/24网段的ip 访问的权限 2.配置nginx的配置文件"default.conf" server {listen …...

    2024/4/24 8:26:20
  7. 安装kafka并设置通过外网ip访问

    1、kafka 安装 安装JDK tar xvf jdk1.8.0_231.tar.gz -C /usr/local && cd /usr/local ln -sv jdk1.8.0_231 jdk vim /etc/profile.d/java.shJAVA_HOME=/usr/local/jdkPATH=$JAVA_HOME/bin:$PATHzookeeper安装(或使用kafka自带的) vim /usr/local/kafka/zookeeper…...

    2024/4/24 8:26:19
  8. echo输出颜色

    语法介绍: echo -e "\e[31m 输入的内容 \e[0m" #输出内容为红色 示例: # 字颜色: 30--37echo -e "\033[30m 黑颜色字 \033[0m"echo -e "\033[31m 红颜色字 \033[0m"echo -e "\033[32m 绿颜色字 \033[0m"echo -e "\033[33m …...

    2024/5/5 17:46:29
  9. mongodb之备份和恢复介绍

    一、安装环境介绍: 演示的mongo的安装环境:二进制安装包mongoDB3.6.16给mongodb授权超级管理员账户: mongo --host 127.0.0.1 --port 6068 db.createUser({user: root, pwd:TdLLQ6689, roles:[{role: root, db: admin}]}); use admin db.auth("root","TdLLQ6…...

    2024/4/24 8:26:17
  10. logstash同步nginx日志到数据库

    本文参考:https://www.cnblogs.com/yanshicheng/articles/9436373.html https://www.cnblogs.com/fawaikuangtu123/articles/10360264.html1.logstash安装(jdk提前安装1.8)rpm -ivh logstash-6.6.2.rpm2.上传数据库驱动jar包wget https://dev.mysql.com/get…...

    2024/4/24 8:26:23
  11. mongodb之mongoexport 和mongoimport介绍

    环境:mongodb3.6.16二进制安装 一、mongoexport 参数和语法介绍: Mongodb中的mongoexport工具可以把一个collection导出成JSON格式或CSV格式的文件。可以通过参数指定导出的数据项,也可以根据指定的条件导出数据。 mongoexport -h IP --port 端口 -u 用户名 -p 密码 -d 数据…...

    2024/4/24 8:26:15
  12. 利用jstat 自动发现监控java程序

    利用jstat 自动发现监控java程序 这个项目搞了好几天,总结了一下原因:对自动发现注册监控不了解原理,之前有遗留的脚本很多都不支持不能 用对脚本还不能够完全掌握,有时间还是要好好看看 还是思路问题,解决问题的方法千千万,不要吊死在一棵树上,多试试几种死法本人比较懒…...

    2024/5/5 18:40:16
  13. 初学者学习Linux选择哪个发行版本合适?

    Linux是免费开源的操作系统,具有非常重要的作用,现在想要学习Linux的人越来越多了。不过很多人学习Linux的目的是不同,有的人可能想要从事相关的工作,有的人可能就是想要多掌握一门技术,那么针对不同情况的初学者,Linux选择哪个发行版本好?接下来为大家介绍一下吧。1、运…...

    2024/4/24 8:26:14
  14. 查看docker File

    #查看docker File #!/bin/bash export PATH=$PATH if [ $# -eq 1 ];thendocker history --format {{.CreatedBy}} --no-trunc=true $1 |sed "s/\/bin\/sh\ -c\ \#(nop)\ //g"|sed "s/\/bin\/sh\ -c/RUN/g" | tacelseecho "sh Obtain_dockerfile.sh $D…...

    2024/4/24 8:26:18
  15. linux知识点1

    常见端口及服务 21/tcp FTP 文件传输协议22/tcp SSH 安全登录、文件传送(SCP)和端口重定向23/tcp Telnet 不安全的文本传送25/tcp SMTP Simple Mail Transfer Protocol (E-mail)53、dns服务67、68 dhcp服务端、客户端69/udp TFTP Trivial File Transfer Protocol79/tcp finger …...

    2024/4/24 8:26:16
  16. 搭建Nginx服务器及深度优化

    一、Nginx介绍Nginx专为性能优化而开发,其最大的优点就是它的稳定性和低系统资源消耗,以及对http并发连接的高处理能力,单台物理服务器可支持20000~50000个并发请求,正是如此,大量提供社交网络、新闻资讯、电子商务及虚拟主机等服务的企业纷纷选择Nginx来提供web服务,目前…...

    2024/4/19 23:55:52
  17. 定时任务小结

    第1章 定时任务系统定时任务 针对所有用户/etc/crontab 用户定时任务crontab -l 列出定时任务crontab -e 编辑定时任务crontab -e /var/spool/cron/用户名 用户名:当前登录系统的用户crontab 类似visudo 语法检测的功能 公司常用的定时任务配置文件/etc/crontab…...

    2024/4/16 15:29:26
  18. Nginx 实现静态资源

    前言nginx作为一款高性能的服务器,用途非常多,除了可以做后端服务器的代理,负载均衡之外,还有一个用途就是做静态资源的缓存服务器,比如在前后端分离的项目中,为了加速前端页面的响应速度,我们可以将前端的相关资源,例如html,js,css或者图片等放到nginx指定的目录下,…...

    2024/4/16 15:29:26
  19. gdb 是符号没法解析怎么办

    现象 碰到一个core , 用gdb 去分析,对应不到代码: warning: Could not load shared library symbols for 19 libraries, e.g. linux-vdso.so.1.Use the "info sharedlibrary" command to see the complete listing.Do you need "set solib-search-path" …...

    2024/4/27 6:06:55
  20. 使用sed 命令查找和替换文件中的字符串的方法总结

    当你在使用文本文件时,很可能需要查找和替换文件中的字符串。sed 命令主要用于替换一个文件中的文本。在 Linux 中这可以通过使用 sed 命令和 awk 命令来完成。在本教程中,我们将告诉你使用 sed 命令如何做到这一点,然后讨论讨论 awk 命令相关的。sed 命令是什么sed 命令表示…...

    2024/4/16 15:29:16

最新文章

  1. js api part3

    环境对象 环境对象: 指的是函数内部特殊的 变量 this , 它代表着当前函数运行时所处的环境 作用: 弄清楚this的指向,可以让我们代码更简洁 函数的调用方式不同,this 指代的对象也不同 【谁调用, this 就是…...

    2024/5/5 20:18:35
  2. 梯度消失和梯度爆炸的一些处理方法

    在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言,在此感激不尽。 权重和梯度的更新公式如下: w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...

    2024/3/20 10:50:27
  3. Ubuntu磁盘扩容

    使用 df -h命令查看系统磁盘控件的使用情况: [samspobosrv:~]$ df -h Filesystem Size Used Avail Use% Mounted on udev 7.8G 0 7.8G 0% /dev tmpfs 1.6G 1.7M 1.…...

    2024/5/5 4:50:46
  4. ChatGPT 初学者指南

    原文:ChatGPT for Beginners 译者:飞龙 协议:CC BY-NC-SA 4.0 介绍 如果您一直关注新闻和趋势,您可能已经在某个地方读到或听到过,Sam Altman 的生成式人工智能平台 ChatGPT 已经将人工智能推向了一个新的高度 - 许多…...

    2024/5/5 16:47:03
  5. 【外汇早评】美通胀数据走低,美元调整

    原标题:【外汇早评】美通胀数据走低,美元调整昨日美国方面公布了新一期的核心PCE物价指数数据,同比增长1.6%,低于前值和预期值的1.7%,距离美联储的通胀目标2%继续走低,通胀压力较低,且此前美国一季度GDP初值中的消费部分下滑明显,因此市场对美联储后续更可能降息的政策…...

    2024/5/4 23:54:56
  6. 【原油贵金属周评】原油多头拥挤,价格调整

    原标题:【原油贵金属周评】原油多头拥挤,价格调整本周国际劳动节,我们喜迎四天假期,但是整个金融市场确实流动性充沛,大事频发,各个商品波动剧烈。美国方面,在本周四凌晨公布5月份的利率决议和新闻发布会,维持联邦基金利率在2.25%-2.50%不变,符合市场预期。同时美联储…...

    2024/5/4 23:54:56
  7. 【外汇周评】靓丽非农不及疲软通胀影响

    原标题:【外汇周评】靓丽非农不及疲软通胀影响在刚结束的周五,美国方面公布了新一期的非农就业数据,大幅好于前值和预期,新增就业重新回到20万以上。具体数据: 美国4月非农就业人口变动 26.3万人,预期 19万人,前值 19.6万人。 美国4月失业率 3.6%,预期 3.8%,前值 3…...

    2024/5/4 23:54:56
  8. 【原油贵金属早评】库存继续增加,油价收跌

    原标题:【原油贵金属早评】库存继续增加,油价收跌周三清晨公布美国当周API原油库存数据,上周原油库存增加281万桶至4.692亿桶,增幅超过预期的74.4万桶。且有消息人士称,沙特阿美据悉将于6月向亚洲炼油厂额外出售更多原油,印度炼油商预计将每日获得至多20万桶的额外原油供…...

    2024/5/4 23:55:17
  9. 【外汇早评】日本央行会议纪要不改日元强势

    原标题:【外汇早评】日本央行会议纪要不改日元强势近两日日元大幅走强与近期市场风险情绪上升,避险资金回流日元有关,也与前一段时间的美日贸易谈判给日本缓冲期,日本方面对汇率问题也避免继续贬值有关。虽然今日早间日本央行公布的利率会议纪要仍然是支持宽松政策,但这符…...

    2024/5/4 23:54:56
  10. 【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响

    原标题:【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响近日伊朗局势升温,导致市场担忧影响原油供给,油价试图反弹。此时OPEC表态稳定市场。据消息人士透露,沙特6月石油出口料将低于700万桶/日,沙特已经收到石油消费国提出的6月份扩大出口的“适度要求”,沙特将满…...

    2024/5/4 23:55:05
  11. 【外汇早评】美欲与伊朗重谈协议

    原标题:【外汇早评】美欲与伊朗重谈协议美国对伊朗的制裁遭到伊朗的抗议,昨日伊朗方面提出将部分退出伊核协议。而此行为又遭到欧洲方面对伊朗的谴责和警告,伊朗外长昨日回应称,欧洲国家履行它们的义务,伊核协议就能保证存续。据传闻伊朗的导弹已经对准了以色列和美国的航…...

    2024/5/4 23:54:56
  12. 【原油贵金属早评】波动率飙升,市场情绪动荡

    原标题:【原油贵金属早评】波动率飙升,市场情绪动荡因中美贸易谈判不安情绪影响,金融市场各资产品种出现明显的波动。随着美国与中方开启第十一轮谈判之际,美国按照既定计划向中国2000亿商品征收25%的关税,市场情绪有所平复,已经开始接受这一事实。虽然波动率-恐慌指数VI…...

    2024/5/4 23:55:16
  13. 【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试

    原标题:【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试美国和伊朗的局势继续升温,市场风险情绪上升,避险黄金有向上突破阻力的迹象。原油方面稍显平稳,近期美国和OPEC加大供给及市场需求回落的影响,伊朗局势并未推升油价走强。近期中美贸易谈判摩擦再度升级,美国对中…...

    2024/5/4 23:54:56
  14. 【原油贵金属早评】市场情绪继续恶化,黄金上破

    原标题:【原油贵金属早评】市场情绪继续恶化,黄金上破周初中国针对于美国加征关税的进行的反制措施引发市场情绪的大幅波动,人民币汇率出现大幅的贬值动能,金融市场受到非常明显的冲击。尤其是波动率起来之后,对于股市的表现尤其不安。隔夜美国股市出现明显的下行走势,这…...

    2024/5/4 18:20:48
  15. 【外汇早评】美伊僵持,风险情绪继续升温

    原标题:【外汇早评】美伊僵持,风险情绪继续升温昨日沙特两艘油轮再次发生爆炸事件,导致波斯湾局势进一步恶化,市场担忧美伊可能会出现摩擦生火,避险品种获得支撑,黄金和日元大幅走强。美指受中美贸易问题影响而在低位震荡。继5月12日,四艘商船在阿联酋领海附近的阿曼湾、…...

    2024/5/4 23:54:56
  16. 【原油贵金属早评】贸易冲突导致需求低迷,油价弱势

    原标题:【原油贵金属早评】贸易冲突导致需求低迷,油价弱势近日虽然伊朗局势升温,中东地区几起油船被袭击事件影响,但油价并未走高,而是出于调整结构中。由于市场预期局势失控的可能性较低,而中美贸易问题导致的全球经济衰退风险更大,需求会持续低迷,因此油价调整压力较…...

    2024/5/4 23:55:17
  17. 氧生福地 玩美北湖(上)——为时光守候两千年

    原标题:氧生福地 玩美北湖(上)——为时光守候两千年一次说走就走的旅行,只有一张高铁票的距离~ 所以,湖南郴州,我来了~ 从广州南站出发,一个半小时就到达郴州西站了。在动车上,同时改票的南风兄和我居然被分到了一个车厢,所以一路非常愉快地聊了过来。 挺好,最起…...

    2024/5/4 23:55:06
  18. 氧生福地 玩美北湖(中)——永春梯田里的美与鲜

    原标题:氧生福地 玩美北湖(中)——永春梯田里的美与鲜一觉醒来,因为大家太爱“美”照,在柳毅山庄去寻找龙女而错过了早餐时间。近十点,向导坏坏还是带着饥肠辘辘的我们去吃郴州最富有盛名的“鱼头粉”。说这是“十二分推荐”,到郴州必吃的美食之一。 哇塞!那个味美香甜…...

    2024/5/4 23:54:56
  19. 氧生福地 玩美北湖(下)——奔跑吧骚年!

    原标题:氧生福地 玩美北湖(下)——奔跑吧骚年!让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 啊……啊……啊 两…...

    2024/5/4 23:55:06
  20. 扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!

    原标题:扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!扒开伪装医用面膜,翻六倍价格宰客!当行业里的某一品项火爆了,就会有很多商家蹭热度,装逼忽悠,最近火爆朋友圈的医用面膜,被沾上了污点,到底怎么回事呢? “比普通面膜安全、效果好!痘痘、痘印、敏感肌都能用…...

    2024/5/5 8:13:33
  21. 「发现」铁皮石斛仙草之神奇功效用于医用面膜

    原标题:「发现」铁皮石斛仙草之神奇功效用于医用面膜丽彦妆铁皮石斛医用面膜|石斛多糖无菌修护补水贴19大优势: 1、铁皮石斛:自唐宋以来,一直被列为皇室贡品,铁皮石斛生于海拔1600米的悬崖峭壁之上,繁殖力差,产量极低,所以古代仅供皇室、贵族享用 2、铁皮石斛自古民间…...

    2024/5/4 23:55:16
  22. 丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者

    原标题:丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者【公司简介】 广州华彬企业隶属香港华彬集团有限公司,专注美业21年,其旗下品牌: 「圣茵美」私密荷尔蒙抗衰,产后修复 「圣仪轩」私密荷尔蒙抗衰,产后修复 「花茵莳」私密荷尔蒙抗衰,产后修复 「丽彦妆」专注医学护…...

    2024/5/4 23:54:58
  23. 广州械字号面膜生产厂家OEM/ODM4项须知!

    原标题:广州械字号面膜生产厂家OEM/ODM4项须知!广州械字号面膜生产厂家OEM/ODM流程及注意事项解读: 械字号医用面膜,其实在我国并没有严格的定义,通常我们说的医美面膜指的应该是一种「医用敷料」,也就是说,医用面膜其实算作「医疗器械」的一种,又称「医用冷敷贴」。 …...

    2024/5/4 23:55:01
  24. 械字号医用眼膜缓解用眼过度到底有无作用?

    原标题:械字号医用眼膜缓解用眼过度到底有无作用?医用眼膜/械字号眼膜/医用冷敷眼贴 凝胶层为亲水高分子材料,含70%以上的水分。体表皮肤温度传导到本产品的凝胶层,热量被凝胶内水分子吸收,通过水分的蒸发带走大量的热量,可迅速地降低体表皮肤局部温度,减轻局部皮肤的灼…...

    2024/5/4 23:54:56
  25. 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...

    解析如下:1、长按电脑电源键直至关机,然后再按一次电源健重启电脑,按F8健进入安全模式2、安全模式下进入Windows系统桌面后,按住“winR”打开运行窗口,输入“services.msc”打开服务设置3、在服务界面,选中…...

    2022/11/19 21:17:18
  26. 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。

    %读入6幅图像(每一幅图像的大小是564*564) f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...

    2022/11/19 21:17:16
  27. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

    win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面,在等待界面中我们需要等待操作结束才能关机,虽然这比较麻烦,但是对系统进行配置和升级…...

    2022/11/19 21:17:15
  28. 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...

    有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows,请勿关闭计算机”的提示,要过很久才能进入系统,有的用户甚至几个小时也无法进入,下面就教大家这个问题的解决方法。第一种方法:我们首先在左下角的“开始…...

    2022/11/19 21:17:14
  29. win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...

    置信有很多用户都跟小编一样遇到过这样的问题,电脑时发现开机屏幕显现“正在配置Windows Update,请勿关机”(如下图所示),而且还需求等大约5分钟才干进入系统。这是怎样回事呢?一切都是正常操作的,为什么开时机呈现“正…...

    2022/11/19 21:17:13
  30. 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...

    Win7系统开机启动时总是出现“配置Windows请勿关机”的提示,没过几秒后电脑自动重启,每次开机都这样无法进入系统,此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一:开机按下F8,在出现的Windows高级启动选…...

    2022/11/19 21:17:12
  31. 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...

    有不少windows10系统用户反映说碰到这样一个情况,就是电脑提示正在准备windows请勿关闭计算机,碰到这样的问题该怎么解决呢,现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法:1、2、依次…...

    2022/11/19 21:17:11
  32. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...

    今天和大家分享一下win7系统重装了Win7旗舰版系统后,每次关机的时候桌面上都会显示一个“配置Windows Update的界面,提示请勿关闭计算机”,每次停留好几分钟才能正常关机,导致什么情况引起的呢?出现配置Windows Update…...

    2022/11/19 21:17:10
  33. 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...

    只能是等着,别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚,只能是考虑备份数据后重装系统了。解决来方案一:管理员运行cmd:net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...

    2022/11/19 21:17:09
  34. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

    原标题:电脑提示“配置Windows Update请勿关闭计算机”怎么办?win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢?一般的方…...

    2022/11/19 21:17:08
  35. 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...

    关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!关机提示 windows7 正在配…...

    2022/11/19 21:17:05
  36. 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...

    钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...

    2022/11/19 21:17:05
  37. 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...

    前几天班里有位学生电脑(windows 7系统)出问题了,具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面,长时间没反应,无法进入系统。这个问题原来帮其他同学也解决过,网上搜了不少资料&#x…...

    2022/11/19 21:17:04
  38. 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...

    本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法,并在最后教给你1种保护系统安全的好方法,一起来看看!电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中,添加了1个新功能在“磁…...

    2022/11/19 21:17:03
  39. 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...

    许多用户在长期不使用电脑的时候,开启电脑发现电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机。。.这要怎么办呢?下面小编就带着大家一起看看吧!如果能够正常进入系统,建议您暂时移…...

    2022/11/19 21:17:02
  40. 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...

    配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!配置windows update失败 还原更改 请勿关闭计算机&#x…...

    2022/11/19 21:17:01
  41. 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...

    不知道大家有没有遇到过这样的一个问题,就是我们的win7系统在关机的时候,总是喜欢显示“准备配置windows,请勿关机”这样的一个页面,没有什么大碍,但是如果一直等着的话就要两个小时甚至更久都关不了机,非常…...

    2022/11/19 21:17:00
  42. 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...

    当电脑出现正在准备配置windows请勿关闭计算机时,一般是您正对windows进行升级,但是这个要是长时间没有反应,我们不能再傻等下去了。可能是电脑出了别的问题了,来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...

    2022/11/19 21:16:59
  43. 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...

    我们使用电脑的过程中有时会遇到这种情况,当我们打开电脑之后,发现一直停留在一个界面:“配置Windows Update失败,还原更改请勿关闭计算机”,等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢&#xff0…...

    2022/11/19 21:16:58
  44. 如何在iPhone上关闭“请勿打扰”

    Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...

    2022/11/19 21:16:57