When we compile OpenResty, we would like to have a "good enough" version so that every plugin in our project is installed.
./configure --prefix=/opt/openresty \
--conf-path=/etc/nginx/nginx.conf \
--with-luajit \
--with-http_iconv_module \
--with-http_postgres_module \
--with-http_iconv_module \
-j2Normally we don't just install OpenResty in an empty machine, but we want to change the existing Nginx binary with the compiled OpenResty(nginx). With the obove compiling options, we already indicated the right nginx configuration file location (existing config files). We only need to change the start/stop script of Nginx now.
Run sudo /etc/nginx/init.d stop to stop the running nginx daemon. Edit /etc/init.d/nginx file, change the following lines:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/nginxto:
PATH=/opt/openresty:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/openresty/nginx/sbin/nginxRun sudo /etc/nginx/init.d start again and we are ready to go!