nginx替换成openresty,nginx替换openresty


安装

wget https://openresty.org/download/openresty-1.11.2.2.tar.gz
tar -xzvf openresty-1.11.2.2.tar.gz
cd openresty-1.11.2.2

查看 nginx 编译选项:
root@iZm5eabkgmsfy2phj5pr1xZ:/usr/local/src/openresty-1.11.2.2# nginx -V
nginx version: nginx/1.10.3
(省略)

./configure   --prefix=/usr/local/openresty --with-luajit --without-http_redis2_module --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-openssl=/usr/local/src/openssl-1.0.2m

make
make install

配置openresty-nginx

openresty-nginx 路径是: /usr/local/openresty/nginx
将原来的nginx 配置都复制到 /usr/local/openresty/nginx/conf

cp /usr/local/nginx/conf/*.conf /usr/local/openresty/nginx/conf/

vhost 目录 ssl 目录

cp -r /usr/local/nginx/conf/conf.d /usr/local/openresty/nginx/conf

还要根据服务器实际情况,修改nginx.conf 等配置文件中替换路径为新的路径

先停止原来的nginx

修改 环境变量

PATH=/usr/local/openresty/nginx/sbin:$PATH
export PATH
改了之后原来的nginx 就没用了,这里我本来就是替换的,所以就这样设置了。

#执行 :
source /etc/profile

#运行 openresty 
nginx 

openresty 在支持http2的时候 响应头header server会修改成nginx

查看 version

root@iZm5eabkgmsfy2phj5pr1xZ:~# nginx -V
nginx version: openresty/1.11.2.2
built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
built with OpenSSL 1.0.2m 2 Nov 2017
TLS SNI support enabled
configure arguments: –prefix=/usr/local/openresty/nginx –with-cc-opt=-O2 —add-(省略)

相关内容

    暂无相关文章