Github Twitter 2 Delicious Linkedin Stackoverflow Google plus new 32px Rss

Passenger and ngx_headers_more Module

Installing

Nginx and Phusion Passenger make a powerful combonation for hosting web applications. Nginx is very flexible and fast. Phusion Passenger is rock solid and can be used to host Ruby, Python, and Node.js applications all at once. Nginx out of the box unfortunally lacks the ability to set or modify HTTP headers from within the configuration files. This is easily rectified by adding the ngx_headers_more module.

The easiest way to install Nginx with Passenger support is through the gem. You'll need to download and unarchive the ngx_headers_more module first, since we will need to point the installer to this location.

Below are the commands I use when installing on a server. If you are installing locally for development they will probably be a bit different, but not much. The passenger-install-nginx-module command is the important one. Note the extra-configure-flags option, this is how you can build Nginx with support for the module.

$ sudo su -
$ mkdir -p /opt/nginx/build-modules
$ wget -P /opt/nginx/build-modules https://github.com/openresty/headers-more-nginx-module/archive/v0.25.tar.gz
$ tar -xzf /opt/nginx/build-modules/v0.25.tar.gz -C /opt/nginx/build-modules
$ gem install passenger
$ passenger-install-nginx-module --prefix=/opt/nginx --extra-configure-flags="--add-module=/opt/nginx/build-modules/headers-more-nginx-module-0.25"

Using

After you have installed Nginx with the ngx_headers_more module you will be able to add and remove headers as you please from within your Nginx configuration files. This can be done from within the http or location blocks. Below is a small example.

The more_clear_headers directive can be used to clear unnecessary headers, like the ones that Passenger and Nginx set to indicate their version (Server, X-Powered-By, X-Runtime).

The more_set_input_headers directive can be used to set a header on the incoming request.

The more_set_headers directive can be used to set a header on the outgoing response.


    http {
      more_clear_headers 'Server' 'X-Powered-By' 'X-Runtime';
      more_set_headers 'X-Current-Hostname: $remote_addr';
      location /foo {
        more_set_input_headers 'X-Location: Foo';
      }
    }
  

Related Links

Comments

Https://Theeliquidboutique.co.Uk
10/17/2018 09:07pm

Every little thing is simple now, thanks to the Web. However, when it concerns advertising my vape company, it still pays to head to different individuals as well as tell them about your service. And that is what I am finishing with the help of this International Vape Store Database. Ever since I got hold of this, I knew I needed to work added difficult to advertise my vape organisation. It's a good idea Katie and her team compiled countless vape stores throughout the world in this data source. That alone suffices to commend them. Currently it's my time to do the work. And also work I did.

Simply put, I more than happy so this database provided me.

I have actually been obtaining calls and inquiries concerning my products since I tried this product. I use this to send out e-mails, newsletters, promos, and the likes to enhance the advertising of my business. As well as in just two months, my web traffic and sights raised and sales had actually been excellent.

Thank you to your team for producing this item. I make sure you have actually assisted a great deal of vape services around. Keep up the good work!

As a local business owner, I attend to different vape events and also exhibits just to market my vape shop. While I can go to each booth as well as talk to them, sometimes it takes a great deal of energy and time to compile them all. I currently have to look after my sales as well as advertise my web site, so I already have a great deal in my hands. I desired there is a device there that will certainly help me in knowing which stores I can advertise my items.

It's a good idea I found this advertising and marketing product. Having countless vape shops around the globe suffices for me to up my advertising and marketing game. Envision, a team assembled all those stores, so we can call them and tell them regarding our products. I do not have to worry about the doing the collection myself because Katie and her group did that for me-- and for every one of the vape entrepreneur around.

I am still beginning to look at this item therefore far, there are a couple of individuals asking about my products. I have yet to see the outcomes of this one, but thus far so excellent.

I use it for my e-newsletters and email projects, as well as have actually seen some wonderful traffic in my site. I'll be providing another evaluation when I obtain the results. Thanks for helping me on this Katie.

Warszawa
Warszawa says:
10/18/2018 06:15am

Poziom atrakcji obiektu przekroczyƂ moje oczekiwania.

Format using Markdown