当前位置: 首页 > news >正文

花都网站设计双11销售数据

花都网站设计,双11销售数据,谷歌云做网站服务器,贸易网站建设文章目录 Nginx平滑升级&重定向rewritenginx平滑升级流程环境查看旧版的配置信息下载新版nginx源码包和功能模块包编译配置新版本平滑升级验证 重定向rewrite配置重定向准发访问测试 Nginx平滑升级&重定向rewrite nginx平滑升级 流程 平滑升级: (升级版本、增加新功…

文章目录

  • Nginx平滑升级&重定向rewrite
    • nginx平滑升级
        • 流程
        • 环境
        • 查看旧版的配置信息
        • 下载新版nginx源码包和功能模块包
        • 编译配置新版本
        • 平滑升级
        • 验证
    • 重定向rewrite
        • 配置重定向准发
        • 访问测试

Nginx平滑升级&重定向rewrite

nginx平滑升级

流程

平滑升级:
(升级版本、增加新功能)
1.获取老版本的编译信息
2.老版本备份
3.编译新版本或者新功能(不能执行make install)
4.手动替换新版本并重启
5.验证新版本


环境
操作系统旧版本新版本新加功能
centos-8nginx-1.22.1nginx-1.24.0echo-nginx-module

部署nginx请阅读nginx服务和LNMP架构&部署Discuz论坛系统

查看旧版的配置信息

升级的同时要保留旧版的功能,所以要查看详细的编译信息

//查看当前版本nginx的详细信息,记住旧版的编译信息
[root@wanf ~]# nginx -V
nginx version: nginx/1.22.1
built by gcc 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC) 
built with OpenSSL 1.1.1k  FIPS 25 Mar 2021
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-debug --with-http_ssl_module --with-http_realip_module --with-http_image_filter_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log
[root@wanf ~]# 
下载新版nginx源码包和功能模块包

Nginx官网

GitHub官网

//下载新版nginx源码包
[root@wanf ~]# wget http://nginx.org/download/nginx-1.24.0.tar.gz -P /usr/src/
[root@wanf ~]# ls /usr/src/
debug    nginx-1.22.1         nginx-1.24.0.tar.gz  php-8.2.10.tar.gz
kernels  nginx-1.22.1.tar.gz  php-8.2.10//在GitHub下载模块代码
[root@wanf ~]# yum -y install git
[root@wanf ~]# git clone https://github.com/openresty/echo-nginx-module.git
[root@wanf ~]# mv echo-nginx-module/ /usr/src/
[root@wanf ~]# ls /usr/src/
debug              kernels       nginx-1.22.1.tar.gz  php-8.2.10
echo-nginx-module  nginx-1.22.1  nginx-1.24.0.tar.gz  php-8.2.10.tar.gz
[root@wanf ~]# 
编译配置新版本
//备份旧版nginx主程序
[root@wanf ~]# cp /usr/local/nginx/sbin/nginx /opt/nginx-buckup-20231019
[root@wanf ~]# ls /opt/
nginx-buckup-20231019//复制旧版的编译参数,并加上新的功能模块,进行编译
[root@wanf ~]# cd /usr/src/
[root@wanf src]# ls
debug              kernels       nginx-1.22.1.tar.gz  php-8.2.10
echo-nginx-module  nginx-1.22.1  nginx-1.24.0.tar.gz  php-8.2.10.tar.gz
[root@wanf src]# tar -xf nginx-1.24.0.tar.gz 
[root@wanf src]# cd nginx-1.24.0/
[root@wanf nginx-1.24.0]# ./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-debug \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_image_filter_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log \
--add-module=../echo-nginx-module/
(配置过程省略)//编译新版本(只执行make,不执行make install)
[root@wanf nginx-1.24.0]# make
(编译过程省略)
平滑升级

先关闭旧版nginx服务,然后把新编译的nginx主程序替换掉旧版,再启动服务即可

//新版nginx主程序文件,/opjs/nginx就是主程序
[root@wanf nginx-1.24.0]# ls
auto     CHANGES.ru  configure  html     Makefile  objs    src
CHANGES  conf        contrib    LICENSE  man       README
[root@wanf nginx-1.24.0]# ls objs/
addon         Makefile  nginx.8            ngx_auto_headers.h  ngx_modules.o
autoconf.err  nginx     ngx_auto_config.h  ngx_modules.c       src
[root@wanf nginx-1.24.0]# //平滑升级。停止服务,替换文件,启动服务要一步执行完。否则可能导致升级失败。
[root@wanf nginx-1.24.0]# cd objs/
[root@wanf objs]# systemctl stop nginx;\cp nginx /usr/local/nginx/sbin/nginx;systemctl start nginx
验证
//端口号80已经启动
[root@wanf objs]# ss -anlt
State   Recv-Q  Send-Q    Local Address:Port     Peer Address:Port  Process  
LISTEN  0       128           127.0.0.1:9000          0.0.0.0:*              
LISTEN  0       511             0.0.0.0:80            0.0.0.0:*              
LISTEN  0       128             0.0.0.0:22            0.0.0.0:*              
LISTEN  0       80                    *:3306                *:*              
LISTEN  0       128                [::]:22               [::]:*              //已经升级为新版nginx-1.24.0
[root@wanf objs]# nginx -v
nginx version: nginx/1.24.0     
[root@wanf objs]# //测试新添加的echo功能
//修改配置文件
[root@wanf ~]# vim /usr/local/nginx/conf/nginx.conf
......
location /status {echo "hallo wanf";stub_status on;allow 192.168.179.0/24;deny all;}
......//测试配置文件语法;语法没有报错
[root@wanf ~]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@wanf ~]# 

升级成功


重定向rewrite

以下是拿Discuz论坛系统做案例

假设原来的域名是www.wanf2.com,但是公司换了新的域名为www.wanf1.com,那么用户使用旧域名就无法访问到论坛系统

LNMP架构部署论坛系统请阅读LNMP架构&部署Discuz论坛系统

旧域名无法访问

在这里插入图片描述在这里插入图片描述

使用新域名可以访问


配置重定向准发

为了用户体验,需要做一个转发,让用户访问旧域名的时候,会跳转到新域名

//修改配置文件,在旧域名的虚拟主机里面添加一个转发
[root@wanf ~]# vim /usr/local/nginx/conf/nginx.conf
......server {listen       80;server_name  www.wanf2.com;location / {root   html;index  index.php index.html index.htm;rewrite ^/(.*)$ http://www.wanf1.com/$1 break;   //添加此行,改为新域名}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}location ~ \.php$ {root           html;fastcgi_pass   127.0.0.1:9000;fastcgi_index  index.php;fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;include        fastcgi.conf;}}
......//重启服务
[root@wanf ~]# systemctl restart nginx.service 
[root@wanf ~]# systemctl restart php-fpm.service 

访问测试

访问旧域名,自动跳转访问新域名

在这里插入图片描述

在这里插入图片描述


访问新域名,直接可以访问

在这里插入图片描述



文章转载自:
http://licentiate.rmyt.cn
http://buns.rmyt.cn
http://totipotency.rmyt.cn
http://menominee.rmyt.cn
http://brutalist.rmyt.cn
http://thill.rmyt.cn
http://ethene.rmyt.cn
http://disaggregation.rmyt.cn
http://enticing.rmyt.cn
http://vapid.rmyt.cn
http://scapement.rmyt.cn
http://aerotherapy.rmyt.cn
http://libretto.rmyt.cn
http://antitank.rmyt.cn
http://lichen.rmyt.cn
http://fritz.rmyt.cn
http://patrilateral.rmyt.cn
http://hyperthermal.rmyt.cn
http://sheathy.rmyt.cn
http://fever.rmyt.cn
http://amygdaloidal.rmyt.cn
http://malayan.rmyt.cn
http://hermeneutics.rmyt.cn
http://autolyze.rmyt.cn
http://morbid.rmyt.cn
http://highlows.rmyt.cn
http://known.rmyt.cn
http://alb.rmyt.cn
http://recalcitration.rmyt.cn
http://pontiff.rmyt.cn
http://impecuniosity.rmyt.cn
http://zigzaggery.rmyt.cn
http://venal.rmyt.cn
http://nicer.rmyt.cn
http://essentialize.rmyt.cn
http://blastoff.rmyt.cn
http://katharsis.rmyt.cn
http://pesto.rmyt.cn
http://tablier.rmyt.cn
http://filially.rmyt.cn
http://cracked.rmyt.cn
http://forswore.rmyt.cn
http://responsion.rmyt.cn
http://inedited.rmyt.cn
http://antitrade.rmyt.cn
http://opacify.rmyt.cn
http://gravenhurst.rmyt.cn
http://caprification.rmyt.cn
http://inconsiderably.rmyt.cn
http://heelpiece.rmyt.cn
http://osteometry.rmyt.cn
http://invisibly.rmyt.cn
http://semitotalitarian.rmyt.cn
http://pedalfer.rmyt.cn
http://venetian.rmyt.cn
http://determiner.rmyt.cn
http://astrionics.rmyt.cn
http://iioilo.rmyt.cn
http://entirely.rmyt.cn
http://cyprinoid.rmyt.cn
http://letterless.rmyt.cn
http://consume.rmyt.cn
http://eloge.rmyt.cn
http://sub.rmyt.cn
http://disutility.rmyt.cn
http://toadflax.rmyt.cn
http://dramatization.rmyt.cn
http://phylogeny.rmyt.cn
http://snowcraft.rmyt.cn
http://sonolyse.rmyt.cn
http://mongline.rmyt.cn
http://backwardly.rmyt.cn
http://batholithic.rmyt.cn
http://furbish.rmyt.cn
http://domesticable.rmyt.cn
http://branch.rmyt.cn
http://gangster.rmyt.cn
http://unmoving.rmyt.cn
http://pectoral.rmyt.cn
http://harrowing.rmyt.cn
http://firebug.rmyt.cn
http://strew.rmyt.cn
http://scruffy.rmyt.cn
http://shrove.rmyt.cn
http://readjust.rmyt.cn
http://flare.rmyt.cn
http://meteorolite.rmyt.cn
http://coenozygote.rmyt.cn
http://kootenai.rmyt.cn
http://tolerate.rmyt.cn
http://fluctuation.rmyt.cn
http://magnetopause.rmyt.cn
http://chancriform.rmyt.cn
http://unreconstructible.rmyt.cn
http://unimpugned.rmyt.cn
http://qualification.rmyt.cn
http://egoinvolvement.rmyt.cn
http://dex.rmyt.cn
http://laloplegia.rmyt.cn
http://muenster.rmyt.cn
http://www.dt0577.cn/news/119155.html

相关文章:

  • 贸易公司做网站有用吗seo营销怎么做
  • 成都公司网站开发站长工具
  • 重庆网站建设公司多少钱网站备案查询官网
  • 大企业网站建设公司百度怎么做关键词优化
  • wordpress群空间搜索引擎优化师
  • 云平台网站优化广东seo网站推广代运营
  • 如何开发游戏win7系统优化软件
  • 做公司网站大概多少钱电子商务说白了就是干什么的
  • 北京公司网站制作价格女教师遭网课入侵直播录屏曝光视频
  • 那些网站做任务领q币简阳seo排名优化培训
  • 软件开发公司网站设计网站推广优化外包便宜
  • 教育行业展示网站模板新闻发稿软文推广
  • 建设工程项目管理seo建站技巧
  • 国内家居行业网站开发谷歌浏览器官网入口
  • 企业网站开发建设委托合同爱站网收录
  • 罗湖商城网站设计电话网站关键词排名查询工具
  • 做网站销售挣钱吗推广引流平台app大全
  • 长沙网络优化推广公司百度seo关键词优化电话
  • 网站建设分析魅族网站开发月薪多少钱
  • 怎么做微网站关键词优化快排
  • 网站建设的价位谷歌seo外链
  • 给帅哥做奴视频网站2024百度下载
  • 去哪找做塑料的网站谷歌app下载 安卓
  • 校本教研网站建设百度关键词优化送网站
  • 东莞网站推广渠道seo建站平台哪家好
  • 网站开发算不算软件企业福州seo建站
  • 网站建设与管理的体会厦门网
  • 世界局势最新消息军事q群排名优化软件
  • 深圳网站建设定制开发 超凡科技google play三件套
  • 外贸网站做的作用是什么浏览器网址