Nginx mirror setup: Difference between revisions

From Skytech
Jump to navigation Jump to search
(Created page with "Category:Linux = Setting up nginx = If you just want a small fast webserver, then on debian you can just install the light version: <pre> aptitude install nginx-light </pre>…")
 
No edit summary
 
Line 22: Line 22:
</pre>
</pre>


== Setting up substituting X-Forwarded-For IP =
== Setting up substituting X-Forwarded-For IP ==
Be sure to include this in your virtual host:
Be sure to include this in your virtual host:
<pre>
<pre>

Latest revision as of 22:08, 7 October 2011


Setting up nginx

If you just want a small fast webserver, then on debian you can just install the light version:

aptitude install nginx-light

This comes with minimal set of core modules.

If you need more modules, like if you're behind a proxy of some sort (another nginx, lighttp, apache, squid or varnish) you'll probably want to be able to read the X-Forwarded-For IP and substitute with that in logfiles.

Luckily that's really easy in nginx although you need the full suite of modules.. so:

aptitude install nginx-full

Setting up directory listing

If you want directory listing, be sure to include this in your virtual host file:

        autoindex on;

Setting up substituting X-Forwarded-For IP

Be sure to include this in your virtual host:

        set_real_ip_from 192.168.0.250;
        real_ip_header X-Forwarded-For;

Of course substitute the above IP with the correct one (the proxy) and you're good to go.

Test settings

Test with

nginx -t