homestead中nginx替换为openresty

1. 下载包(版本自行挑选)

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

 

2. 查看 nginx 编译选项:

nginx -V

nginx version: nginx/1.10.3 (省略)


3. 配置 openresty 的编译选项:

./configure --prefix=/usr/share/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-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-mcUg8N/nginx-1.14.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module

 

4. 开始编译,这里可能会报错,因为没有geo-ip和libxml2等模块,相关安装自行百度

make

make install

 

5. 安装完成后进入/usr/sbin目录
sudo ln -fF /usr/share/openresty/nginx/sbin/nginx nginx


6. 重启nginx即可
sudo nginx -s reload

 

最好把nginx -V查出来的配置写在新的配置上,注意原来的nginx安装在/usr/share/nginx下,现在要安装在/usr/share/openresty下需要把环境变量中nginx的启动脚本重新软链到新
的nginx中

安装过程中发现http_image_filter_module和http_geoip_module模块安装有问题,上网查过后没有合适的解决方案,需要再研究。
posted @ 2018-07-13 18:01  不骑乌骓  阅读(565)  评论(0编辑  收藏  举报