Board logo

标题: CentOS8_lnmp1.7_更改Nginx的版本 [打印本页]

作者: admin    时间: 2021-7-13 16:14     标题: CentOS8_lnmp1.7_更改Nginx的版本

笺注:这是在 CentOS8_lnmp1.7_LNMP 的基础上进行的。 查看Nginx的版本: [root@centos8 ~]# nginx -v nginx version: nginx/1.18.0 [root@centos8 ~]# nginx -V nginx version: nginx/1.18.0 built by gcc 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC) built with OpenSSL 1.1.1g 21 Apr 2020 TLS SNI support enabled configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-stream --with-stream_ssl_module --with-openssl=/root/lnmp1.7-full/src/openssl-1.1.1g --with-openssl-opt='enable-weak-ssl-ciphers' 更改Nginx的版本: 图片1.png 图片2.png 默认会从公网下载软件包,但以防下载失败,最好先把新软件包放在 /root/lnmp1.7-full/src ,更新时就无需连接公网了。 You can get version number from http://nginx.org/en/download.html 图片3.png 备注:如果连接公网安装成功,自动下载下来的软件包也会放在 /root/lnmp1.7-full/src 开始或取消: 图片4.png Nginx的版本更改成功:(最好重启一下服务器) 图片5.png Nginx的软件包: [root@centos8 ~]# cd lnmp1.7-full/src/ [root@centos8 src]# ls nginx-* nginx-1.14.2.tar.gz nginx-1.18.0.tar.gz 再次查看Nginx的版本: [root@centos8 ~]# nginx -v nginx version: nginx/1.14.2 [root@centos8 ~]# nginx -V nginx version: nginx/1.14.2 built by gcc 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC) built with OpenSSL 1.1.1g 21 Apr 2020 TLS SNI support enabled configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-stream --with-stream_ssl_module --with-openssl=/root/lnmp1.7-full/src/openssl-1.1.1g --with-openssl-opt='enable-weak-ssl-ciphers' Nginx会随着系统的启动而启动: [root@centos8 ~]# systemctl is-enabled nginx enabled 查看Nginx的进程: [root@centos8 ~]# ps -ef |grep nginx |grep -v grep root 13944 1 0 09:33 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf www 13946 13944 0 09:33 ? 00:00:00 nginx: worker process Nginx的主配置文件: [root@centos8 ~]# cat /usr/local/nginx/conf/nginx.conf |grep -v "^$" user www www; worker_processes auto; worker_cpu_affinity auto; error_log /home/wwwlogs/nginx_error.log crit; pid /usr/local/nginx/logs/nginx.pid; #Specifies the value for maximum file descriptors that can be opened by this process. worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200; multi_accept off; accept_mutex off; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 50m; sendfile on; sendfile_max_chunk 512k; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 256k; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss; gzip_vary on; gzip_proxied expired no-cache no-store private auth; gzip_disable "MSIE [1-6]\."; #limit_conn_zone $binary_remote_addr zone=perip:10m; ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section. server_tokens off; access_log off; server { listen 80 default_server reuseport; #listen [::]:80 default_server ipv6only=on; server_name _; index index.html index.htm index.php; root /home/wwwroot/default; #error_page 404 /404.html; # Deny access to PHP files in specific directory #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; } include enable-php.conf; location /nginx_status { stub_status on; access_log off; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } location ~ /.well-known { allow all; } location ~ /\. { deny all; } access_log /home/wwwlogs/access.log; } include vhost/*.conf; } 备注:Nginx更改版本后,一切正常。 笺注:实验中,Nginx/1.18.0无法安装云锁的Web应用Nginx的插件,但Nginx/1.14.2可以。 相关文章: CentOS8_云锁+Nginx Nginx/1.14.2重新编译安装使用Jemalloc 更新Nginx版本+Nginx版网站安全狗

图片附件: 图片1.png (2021-7-13 16:10, 97.68 KB) / 下载次数 104
http://blog.zhuohua.store/attachment.php?aid=18507&k=1a06e0a0d4fc0ac00b69b406d20b3c1f&t=1714313227&sid=7Njwn7



图片附件: 图片2.png (2021-7-13 16:10, 85.27 KB) / 下载次数 110
http://blog.zhuohua.store/attachment.php?aid=18508&k=4fcfd9487f1cef7ea9d53eb72231b06d&t=1714313227&sid=7Njwn7



图片附件: 图片3.png (2021-7-13 16:11, 87.23 KB) / 下载次数 88
http://blog.zhuohua.store/attachment.php?aid=18509&k=07f178d575c28f8d6f62681ca68eb84a&t=1714313227&sid=7Njwn7



图片附件: 图片4.png (2021-7-13 16:11, 42.98 KB) / 下载次数 98
http://blog.zhuohua.store/attachment.php?aid=18510&k=3d8517b5692af30ce7605686c5fea6d9&t=1714313227&sid=7Njwn7



图片附件: 图片5.png (2021-7-13 16:12, 38.83 KB) / 下载次数 106
http://blog.zhuohua.store/attachment.php?aid=18511&k=56015a8e516074e8286c968af70340da&t=1714313227&sid=7Njwn7






欢迎光临 blog.zhuohua.store (http://blog.zhuohua.store/) Powered by Discuz! 7.2