ubuntu16.04安装nginx并支持https

1.ssh登录服务器

2.下载nginx安装文件: wget http://nginx.org/download/nginx-1.15.1.tar.gz

3.解压: tar -zxvf nginx-1.15.1.tar.gz

4.安装依赖:sudo apt-get update

sudo apt-get install openssl

sudo apt-get install libssl-dev

sudo apt-get install libpcre3-dev 

sudo apt-get install gcc

sudo apt-get install libpcre3 libpcre3-dev

5.进入解压后的文件夹:cd nginx-1.15.1

6.编译:./configure --with-http_ssl_module (如果不带上--with-http_ssl_module则不支持https)
 
7、sudo apt-get install git

8、下载subs_filter模块

cd /tmp

git clone git://github.com/yaoweibin/ngx_http_substitutions_filter_module.git

9、./configure --with-http_ssl_module --with-http_sub_module --add-module=/tmp/ngx_http_substitutions_filter_module/

10.安装:make install (如果有错误 有可能是权限问题 试试使用sudo make install执行) 安装后的文件默认放在/usr/local/nginx/下面

11.测试: sudo ./nginx -v 显示版本

 

基本命令:

sudo ./nginx -t: 测试

sudo ./nginx -s reload: 重新载入配置文件(记住,修改了配置文件需要重新载入,不能直接reopen)

sudo ./nginx -s stop :停止

sudo ./ngxin -s reopen :重启

 

 

     感谢您的关注
 

 

posted @ 2022-11-01 14:56  坤霸天下  阅读(352)  评论(0编辑  收藏  举报