nginx安装部署及配置
- 一、安装
- 二、部署
- 三、配置
- 四、常见问题
- 1、SSL安全配置
- 1.1、Linux系统下ngnix使用HTTPS协议启动报错:
- 1.2、报错原因:
- 1.3 、解决方式
- 1.3.1 检查是否有ssl模块 先查看nginx原有的模块:先进入nginx安装目录,一般为 /usr/local/nginx(下图显示的是楼主自己修改的安装目录,与此不同)
- 1.3.2 配置ssl模块时,需先安装openssl及openssl-devel,可使用如下命令安装:yum -y install openssl openssl-devel
- 1.3.3 然后再运行命令
- 1.3.4 等配置完成后,运行命令: make 这里不要进行make install,否则就是覆盖安装
- 1.3.5 然后备份原有已安装好的nginx:
- 1.3.6 然后将刚刚编译好的nginx覆盖掉原有的nginx(这个时候nginx要停止状态):
一、安装
1、安装前准备
2、安装方式
二、部署
安装及部署参考:https://www.cnblogs.com/xxoome/p/5866475.html
三、配置
四、常见问题
1、SSL安全配置
1.1、Linux系统下ngnix使用HTTPS协议启动报错:
nginx: [emerg] the “ssl” parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.c
1.2、报错原因:
未安装SSL模块–ngx_http_ssl_module
1.3 、解决方式
1.3.1 检查是否有ssl模块 先查看nginx原有的模块:先进入nginx安装目录,一般为 /usr/local/nginx(下图显示的是楼主自己修改的安装目录,与此不同)
然后输入*./sbin/nginx -V *
未安装SSL模块时 在configure arguments:后面显示的参数如下:–prefix=/usr/local/nginx
1.3.2 配置ssl模块时,需先安装openssl及openssl-devel,可使用如下命令安装:yum -y install openssl openssl-devel
1.3.3 然后再运行命令
./sbin/configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module即可
1.3.4 等配置完成后,运行命令: make 这里不要进行make install,否则就是覆盖安装
1.3.5 然后备份原有已安装好的nginx:
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
1.3.6 然后将刚刚编译好的nginx覆盖掉原有的nginx(这个时候nginx要停止状态):
cp ./objs/nginx /usr/local/nginx/sbin/ 然后启动nginx,仍可以通过命令查看是否已经加入成功 /usr/local/nginx/sbin/nginx -V
已安装SSL模块时, 在configure arguments:后面显示的参数如下:
configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module