<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bert&#039;s notes &#187; nginx</title>
	<atom:link href="https://a20.net/bert/tag/nginx/feed/" rel="self" type="application/rss+xml" />
	<link>https://a20.net/bert</link>
	<description></description>
	<lastBuildDate>Mon, 02 Nov 2020 10:47:22 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8.5</generator>
	<item>
		<title>Which nginx location stanza is being evaluated?</title>
		<link>https://a20.net/bert/2015/07/27/which-nginx-location-stanza-is-being-evaluated/</link>
		<comments>https://a20.net/bert/2015/07/27/which-nginx-location-stanza-is-being-evaluated/#comments</comments>
		<pubDate>Mon, 27 Jul 2015 15:02:27 +0000</pubDate>
		<dc:creator><![CDATA[bert]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[custom header]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">https://a20.net/bert/?p=34</guid>
		<description><![CDATA[One thing I&#8217;ve had to get used to working with nginx, is that it can be hard to understand which configuration stanza (which part / section of the nginx virtualhost configuration file) is being evaluated, especially given an existing site with a complex history. Useful trick here is to add a custom header for each [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>One thing I&#8217;ve had to get used to working with nginx, is that it can be hard to understand which configuration stanza (which part / section of the nginx virtualhost configuration file) is being evaluated, especially given an existing site with a complex history.</p>
<p>Useful trick here is to add a custom header for each of the sections, like so:</p>
<blockquote><p>server {<br />
add_header X-My-Debug-Header-01 srv;<br />
listen 80 default_server;</p>
<p>location ~ test\.php$ {<br />
add_header X-My-Debug-Header-02 loc-test-php;<br />
try_files $uri =404;<br />
fastcgi_pass unix:/var/run/php5-fpm.sock;<br />
include fastcgi_params;<br />
}</p>
<p>location /pictures {<br />
add_header X-My-Debug-Header-03 loc-pictures;<br />
alias /usr/share/nginx/html;<br />
index index.php index.html index.htm;<br />
}</p>
<p>}</p></blockquote>
<p>Now, for each section match, there will be a convenient header which can be viewed with e.g. <code>wget --server-response</code> (wget -S) or <code>curl --head</code> (curl -I).</p>
<p>Caveats: the Firefox LiveHTTPHeaders plugin doesn&#8217;t seem to show non standard headers. Also, when nginx serves a 40x or 50x, the custom header tends not to get served.</p>
]]></content:encoded>
			<wfw:commentRss>https://a20.net/bert/2015/07/27/which-nginx-location-stanza-is-being-evaluated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
