nginx版本升级

0)备份(其实不用备份这么多)
cd /usr/local/
cp -r nginx nginx-bak-20220627
 
1)上传nginx压缩包,data目录下(参考原来的),解压
cd /data
tar -zvxf nginx-1.22.0.tar.gz
 
2)cd nginx目录下, 执行./configure (获取原nginx的编译参数,cd /usr/local/nginx/sbin/ ./nginx -V 复制,重新编译)
./configure --add-module=../fastdfs-nginx-module/src --prefix=/usr/local/nginx --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre
 
3)make && make install
 
4)重启,nginx -s reload,-v 验证版本号
 
 
 
配置代理转发sftp请求

1)nginx.conf配置文件增加以下配置

stream {
upstream sftp {

#代理的sftp的ip:端口

server ${ip}:${port};
}

server {

#nginx监听的端口
listen 22222;
listen [::]:22222;
proxy_connect_timeout 10s;
proxy_pass sftp;
}
}

2)查看nginx编译参数是否有stream

 ./nginx -V,查看编译参数是否有stream,没有的话,需要和重新编译(参考上面流程),然后重启nginx
configure arguments: --prefix=/usr/local/nginx --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream
3)nginx -t,-s reload,
若reload失败,可以kill master process,再重启nginx ,cd xxx/sbin/, 执行 ./nginx 重启。
 参考:https://wenku.baidu.com/view/aa5e35ad01d276a20029bd64783e0912a2167cc8.html
 
4)检验
看是nginx否有监听端口,netstat -anp|grep 22222,有则通过 sftp命令登录,上传个文件测试。
 
posted @   乌云de博客  阅读(949)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示