Can this package be recompiled Can this package be recompiled nginx nginx

Can this package be recompiled


Redhat and related distributions (fedora, centos) keep their source rpms in a highly regular directory tree. for RHEL5 you want: ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/ for other releases, you can browse the ftp server until you find what you want. Otherwise, google for the exact version of nginx you have (rpm -q nginx)

Assuming you can find the srpm, install it with rpm:

rpm -ivh nginx-xxxx.src.rpm

This'll put the sources and build files in /usr/src/redhat/{BUILD,SPEC,SRC,SOURCES}. You can modify the .spec file in /usr/src/redhat/SPEC to build the module you want along with the rest of nginx, or you can build nginx manually.

Which module do you want to build? In fedora's nginx.spec, several modules are specified when configure is run. This may be as simple as adding a line here:

./configure \[snip...]--with-http_realip_module \--with-http_addition_module \--with-http_sub_module \--with-http_dav_module \--with-http_flv_module \--with-http_gzip_static_module \--with-http_stub_status_module \--with-http_perl_module \[snip...]

After adding whatever changes to nginx.spec, you can build the final rpm with rpmbuild:

rpmbuild -ba nginx.spec

Assuming the package builds without error, rpmbuild will leave it in /usr/src/redhat/RPMS/

Update: yum will want to replace your nginx package as updates become available. You will probably want to rebuild each new package as it becomes available, using the same process as above. However, If security is not a concern, you can simple exclude nginx from the update list by adding the following to your yum config (probably /etc/yum.repos.d/${repo}.repo or similar. Be sure to associate it with the right repo):

exclude=nginx*

Or running yum with the --exclude option

yum --exclude=nginx*