1.首先,找到Nginx安装包的位置。比如,我的是:/usr/local/src/nginx-1.15.1
cd /usr/local/src/nginx-1.15.1
【查看Nginx版本命令】/usr/local/nginx/sbin/nginx -V (/usr/local/nginx/是你Nginx服务器的实际位置)
2.生成新的Nginx配置。执行
/usr/local/nginx/sbin/nginx -V
查看configure arguments:后边有没有值,如果有,就复制下来。
然后执行
./configure --原来有的模块(如果有的话) --with-http_ssl_module
然后覆盖nginx之前的二进制文件(注意,make就可以了,不需要make install)
make
3.关闭现在运行的Nginx服务器。
/usr/local/nginx/sbin/nginx -s stop
由于我的配置文件报错,缺少
nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:121
所以无法关闭。于是,我尝试把新的正确的nginx.conf替换出问题的nginx.conf。
再次执行关闭,成功。
4.OK,执行最后的步骤。把编译好的nginx覆盖掉原有的nginx。
cp ./objs/nginx /usr/local/nginx/sbin/
此时会询问是否覆盖,输入y同意,开始覆盖。如果提示文件繁忙,也可以先去到nginx安装目录下sbin目录把nginx先停止,再完成上述覆盖操作。
然后我们重启nginx,配置好ssl就可以正常使用了。
log_format main '$remote_addr $remote_user [$time_local] $request_time $request_method "http://$host$request_uri" $server_protocol $status $sent_http_content_type $bytes_sent $sent_http_content_length "$http_referer" "$http_user_agent" ' " up_addr:$upstream_addr" " up_resp:$upstream_response_time" "s" " up_status:$upstream_status " $http_x_forwarded_for;
upstream a_server {
server localhost:8003;
}
server {
listen 443 ssl;
server_name edu.a.com;
root /home/iaiai/workstation/webapp/xxx.front;
ssl_certificate /home/iaiai/workstation/ssl/server.crt;
ssl_certificate_key /home/iaiai/workstation/ssl/server.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH:AESGCM:HIGH:!RC4:!DH:!MD5:!3DES:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
location /api/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_connect_timeout 240;
proxy_send_timeout 240;
proxy_read_timeout 240;
client_body_buffer_size 100m;
client_max_body_size 100m;
client_body_temp_path /tmp;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://a_server/;
}
}
分享到:
相关推荐
ngx_http_dav_ext_module.so centos7 nginx 1.18 可以作为模块加载
Centos 7 64 +[nginx+ngx_lua 模块] 支持WAF防护功能 可以作为喔
2022年5月30日 官方当前最新稳定版本nginx 二进制rpm包 适用于x86架构centos7 rhel7版本操作系统升级安装nginx 该包开启了ipv6支持,添加了nginx-rtmp模块支持
nginx rpm package for centos7 nginx rpm package for centos7 nginx rpm package for centos7 nginx rpm package for centos7 nginx rpm package for centos7 nginx rpm package for centos7 nginx rpm package ...
1分钟完美安装最新_CentOS_ _Nginx_ _PHP-FPM_ _MySQL
centOS8安装nginx及nginx配置
centos安装Nginx配置 视频讲解: https://www.bilibili.com/video/BV1Zp4y1X71T?vd_source=7ba09b63e46a5f7eccd25c865fcd09b8#reply117266227680
centos7配置nginx虚拟主机
nginx 离线安装包nginx 离线安装包
后经反复测试,已找到解决以上两个问题方法,1安装ngx_http_proxy_connect_module 模块即可支持https代理。2安装lua-nginx-module模块用来解决非80端口代理。 附件包含了全部安装过程,包括nginx.conf lua的配置,...
2022年5月30日,官方当前最新稳定版本nginx 1.22.0 已经开启ipv6支持,nginx-http-flv-module模块支持 适用于x86架构的centos7 rhel7系列版本操作系统安装升级使用或者修复安全漏洞等
很难找的 centos7 nginx-1.6.2-1.el7.centos.ngx.x86_64.rpm 包
CentOS6 yum 源:centos6_base.repo
ngx_lua nginx + lua + C++ 环境配置: 推荐OpenResty安装(如果你已经安装过了nginx,请参考第9条) 安装步骤可以参考 1.安装依赖,我的是centos,其他系统请参考上边链接里的说明 yum install readline-devel pcre-devel...
在完全无互联网连接的情况下,离线安装nginx。 nginx版本号:nginx-1.20.1-2.el7.x86_64 食用方法: 1.解压 2.进入解压目录 3.rpm安装全部 4.安装完成
nginx.conf nginx-1.20.1.tar.gz 这是关于centos8的nginx 和nginx 的配置https文件
module--with-http_slice_module--with-pcre-jitpcre-8.39zlib-1.2.11openssl-1.1.1ngx_http_substitutions_filter_modulengx_cache_purgengx_brotli安装wget https://raw.githubusercontent.com/helloxz/ngi
Nginx 是一款轻量级的 Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,它是由 C 语言开发,建议在 Linux 下运行。 该文档编写了centos下安装nginx的详细步骤及配置说明。
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
CentOS5.5 安装nginx的详细步骤