Install more_set_headers in nginx 1.15.8

Server Fault Asked by Curious Sam on October 28, 2020

Ubuntu 16 Server – load_module modules/ does not work out the box from a fresh install.

[email protected] /etc/nginx # nginx -V
nginx version: nginx/1.15.8
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)
built with OpenSSL 1.0.2g  1 Mar 2016
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/ --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

While trying to install nginx-extras I receive a dependency error.

[email protected] /etc/nginx # apt-get install nginx-extras
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 nginx-extras : Depends: nginx-common (= 1.10.3-0ubuntu0.16.04.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

To meet the dependency, it takes me back to nginx 1.10

I installed nginx by adding to the /etc/apt/sources.list file

# nginx
deb xenial nginx
deb-src xenial nginx

Can someone shed some light on my issue?

3 Answers

This is what I did to have enable more_set_headers on Ubuntu 16.04, since the module is an extra module and not created by nginx as @MichaelHampton explained below. With his guidance I was able to install nginx with more_set_headers.

#==  I backed up my nginx folder to home    
tar -czvf /home/nginx.tar.gz /etc/nginx

#==  I removed then purged nginx - not sure if both are necessary
sudo apt remove nginx
sudo apt autoremove
sudo apt purge nginx

#==  I removed all nginx entries from /etc/apt/sources.list
nano /etc/apt/sources.list

#==  I did an apt-update and installed nginx
sudo apt update
sudo apt upgrade
sudo apt install nginx

#== I checked the version that was installed
nginx -v

#==  I then upgraded nginx to the latest stable
sudo apt install software-properties-common
sudo add-apt-repository ppa:nginx/$nginx
sudo apt update
sudo apt dist-upgrade

#==  I then installed nginx-extras
sudo apt install nginx-extras

Once the above was completed, I edited my /etc/nginx/nginx.conf and added the following as my first line:
load_module modules/;

I then added the following to the http block:
more_set_headers Server: Uber;

I checked to see if my config was okay with nginx -t

Finally, I restarted the server with service nginx restart

As a final check, I went over to, to see if "Nginx" was showing. Be sure to check Hide Results and Follow redirects

Check Results at Header Security

Hope this helps someone

Correct answer by Curious Sam on October 28, 2020

The answer by Curuios Sam doesn't explain why it happens and the comment by Michael Hampton does, I am compiling the both below to easier readability.

This happens because the module(http-more) you are looking for does not exist in the repo.

That module list can be found in (filter author by nginx).

The http-more can be found the the nginx-extras packages from the nginx ppa.

First remove the repo from /etc/apt/sources.list, then add the ppa.

sudo add-apt-repository ppa:nginx/stable
sudo apt-get update

then upgrade nginx-common and nginx-extras

sudo apt-get install nginx-common
sudo apt-get install nginx-extras

Answered by miyuru on October 28, 2020

Have a look at my tutorial here for more details about how I did this on Amazon Linux (similar to Centos / Red Hat). I wrote this a while back, and I update it occasionally, but it may not be perfect. I'll test it and update again when I get time.

cd /home/ec2-user
mkdir nginx-build
cd nginx-build
service nginx stop
yum groupinstall "Development Tools"
yum install pcre-devel zlib-devel openssl-devel
git clone

tar -xzf nginx-1.15.8.tar.gz
tar -xzf v0.33.tar.gz

# Includes some machine specific optimisations
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/ --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_gunzip_module --with-http_gzip_static_module --with-threads --with-file-aio --with-http_v2_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=native' --add-module=../ngx_cache_purge-2.3 --add-module=../headers-more-nginx-module
make && make install
make clean  (NB: optional)
service nginx start

Answered by Tim on October 28, 2020

Add your own answers!

Related Questions

How to install company proxy certificate

1  Asked on January 9, 2021 by chandima-jayawickrema


Windows server 2019 RRAS slow download speed

0  Asked on January 9, 2021 by selfishcrawler


Allow download of pdf files only in .htacces file

0  Asked on January 9, 2021 by user2033464


Freeradius LDAP through AP

1  Asked on January 9, 2021 by smok


NFS access from multiple networks

1  Asked on January 7, 2021


Nginx+gunicorn 404

1  Asked on January 6, 2021 by vassily


Docker swarm, all containers get restarted

1  Asked on January 6, 2021 by saabeilin


Error when update Sugarcrm CE via Admin->Upgrade

0  Asked on January 5, 2021 by ashish-kumar-dubeyitho-noidain


Is deploying .NET Framework 3.5 possible in WSUS?

4  Asked on January 5, 2021 by thecleaner


How to know if the server application is listening on ipv6

2  Asked on January 5, 2021 by lapinkoira


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir