Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Compile nginx from source, include the Headers More module - Ubuntu
sudo su -
# stuff we need to build from source
apt-get install libpcre3-dev build-essential libssl-dev
# get the nginx source
cd /opt/
wget http://nginx.org/download/nginx-0.8.54.tar.gz
tar -zxvf nginx*
# we'll put the source for nginx modules in here
mkdir /opt/nginxmodules
cd /opt/nginxmodules
# get the source for the Headers More module - see http://wiki.nginx.org/HttpHeadersMoreModule
wget --no-check-certificate http://github.com/agentzh/headers-more-nginx-module/tarball/v0.14
tar -zxvf v0.14
mv agentzh-headers-more-nginx-module-2cbbc15 headers-more
cd /opt/nginx*/
# configure with chosen modules - see http://wiki.nginx.org/InstallOptions & http://articles.slicehost.com/2008/5/13/ubuntu-hardy-installing-nginx-from-source
./configure \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--http-log-path=/var/log/nginx/access.log \
--with-http_dav_module \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--with-http_stub_status_module \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--with-debug \
--add-module=/opt/nginxmodules/headers-more
make
make install
vi /etc/init.d/nginx # edit the DEAMON with the correct new path, which is now /usr/local/nginx/sbin/nginx
/etc/init.d/nginx start
# Nginx should now be running - test it by visting your http://hostname/
@denys-popov

This comment has been minimized.

Copy link

@denys-popov denys-popov commented Jun 7, 2011

Thanks, very useful!

@DaveM2011

This comment has been minimized.

Copy link

@DaveM2011 DaveM2011 commented Oct 2, 2012

It is indeed :) Thanks also

@vbajpai

This comment has been minimized.

Copy link

@vbajpai vbajpai commented Mar 6, 2013

maybe add --with-http_ssl_module, --with-pcre and --with-ipv6

>> ./configure \
    --conf-path=/etc/nginx/nginx.conf \
    --error-log-path=/var/log/nginx/error.log \
    --pid-path=/var/run/nginx.pid \
    --lock-path=/var/lock/nginx.lock \
    --http-log-path=/var/log/nginx/access.log \
    --with-http_dav_module \
    --http-client-body-temp-path=/var/lib/nginx/body \
    --http-proxy-temp-path=/var/lib/nginx/proxy \
    --with-http_stub_status_module \
    --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
    --with-debug \
    --with-http_ssl_module \
    --with-pcre \
    --with-ipv6
@sydcanem

This comment has been minimized.

Copy link

@sydcanem sydcanem commented Apr 16, 2013

Thanks

@lucassimon994

This comment has been minimized.

Copy link

@lucassimon994 lucassimon994 commented Jul 25, 2013

What do you put into the /etc/init.d/nginx file?

@CMCDragonkai

This comment has been minimized.

Copy link

@CMCDragonkai CMCDragonkai commented Jun 9, 2014

What is this for? http-client-body-temp-path

@bsmoo

This comment has been minimized.

Copy link

@bsmoo bsmoo commented Nov 23, 2015

You may also want to include a apt-get update as the first step...

@palaboy

This comment has been minimized.

Copy link

@palaboy palaboy commented Dec 15, 2016

thanks i compile this method on CentOS

@maszd

This comment has been minimized.

Copy link

@maszd maszd commented Apr 2, 2017

Hi @palaboy can you share your method please, iam use centos too.
Thanks

@ramya397

This comment has been minimized.

Copy link

@ramya397 ramya397 commented Apr 17, 2017

Hi
i am getting below error while compiling , as i don't know much about C, i am not able to solve this issue please help

/opt/vtsmodules/nginx-module-vts/src/ngx_http_vhost_traffic_status_string.c

/opt/vtsmodules/nginx-module-vts/src/ngx_http_vhost_traffic_status_string.c: In function 'ngx_http_vhost_traffic_status_replace_strc':
/opt/vtsmodules/nginx-module-vts/src/ngx_http_vhost_traffic_status_string.c:161:9: error: implicit declaration of function 'ngx_memmove' [-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/src/ngx_http_vhost_traffic_status_string.o] Error 1
make[1]: Leaving directory `/opt/nginx-0.8.54'
make: *** [build] Error 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.