Skip to content

Instantly share code, notes, and snippets.

@erain
Last active December 23, 2015 10:19
Show Gist options
  • Save erain/6620998 to your computer and use it in GitHub Desktop.
Save erain/6620998 to your computer and use it in GitHub Desktop.
Install OpenResty in Ubuntu 12.04

Install OpenResty in Ubuntu 12.04

Compile Options

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 \
-j2

Change the Nginx start/stop script

Normally 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/nginx

to:

PATH=/opt/openresty:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/openresty/nginx/sbin/nginx

Run sudo /etc/nginx/init.d start again and we are ready to go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment