load different robots in the same one "server" block<br>&nbsp;<br>&nbsp;&nbsp; location ~ /robots.txt<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($host = 'first.domain') {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rewrite ^/robots\.txt /path/to/another/robots.txt last;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br><br>zhys9<br><div><includetail><div>&nbsp;</div><div>&nbsp;</div><div style="color: rgb(0, 0, 0);"><div style="font-size: 12px; font-family: Arial Narrow; padding: 2px 0pt;">------------------&nbsp;Original&nbsp;------------------</div><div style="font-size: 12px; background: none repeat scroll 0% 0% rgb(239, 239, 239); padding: 8px;"><div id="menu_sender"><b>From: </b>&nbsp;"nginx-request"&lt;nginx-request@nginx.org&gt;;</div><div><b>Date: </b>&nbsp;Sat, May 22, 2010 01:33 AM</div><div><b>To: </b>&nbsp;"nginx"&lt;nginx@nginx.org&gt;; </div><div></div><div><b>Subject: </b>&nbsp;nginx Digest, Vol 7, Issue 47</div></div><div>&nbsp;</div>
Send nginx mailing list submissions to<br>        nginx@nginx.org<br><br>To subscribe or unsubscribe via the World Wide Web, visit<br>        http://nginx.org/mailman/listinfo/nginx<br>or, via email, send a message with subject or body 'help' to<br>        nginx-request@nginx.org<br><br>You can reach the person managing the list at<br>        nginx-owner@nginx.org<br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of nginx digest..."<br><br><br>Today's Topics:<br><br>&nbsp;&nbsp; 1. Re: loading a different robots.txt file for a different sub<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domain? (Ray)<br>&nbsp;&nbsp; 2. Re: loading a different robots.txt file for a different sub<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domain? (Ray)<br>&nbsp;&nbsp; 3. Re: loading a different robots.txt file for a different sub<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domain? (Ilan Berkner)<br>&nbsp;&nbsp; 4. Re: loading a different robots.txt file for a different sub<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domain? (Igor Sysoev)<br>&nbsp;&nbsp; 5. nginx 0day exploit for nginx + fastcgi PHP (Avleen Vig)<br>&nbsp;&nbsp; 6. Re: nginx 0day exploit for nginx + fastcgi PHP (Avleen Vig)<br>&nbsp;&nbsp; 7. Re: nginx 0day exploit for nginx + fastcgi PHP (Michael Shadle)<br>&nbsp;&nbsp; 8. Re: nginx 0day exploit for nginx + fastcgi PHP (Michael Shadle)<br>&nbsp;&nbsp; 9. Re: nginx 0day exploit for nginx + fastcgi PHP (Igor Sysoev)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Fri, 21 May 2010 21:53:45 +0800<br>From: Ray &lt;gunblad3@gmail.com&gt;<br>To: nginx@nginx.org<br>Cc: nginx@sysoev.ru<br>Subject: Re: loading a different robots.txt file for a different sub<br>        domain?<br>Message-ID:<br>        &lt;AANLkTilS4qcF-LEDsGXyml1zu2YspTj6wSrRQHGq48-N@mail.gmail.com&gt;<br>Content-Type: text/plain; charset=UTF-8<br><br>Yes.<br><br>server {<br>&nbsp;&nbsp;&nbsp; listen 80 default;<br>&nbsp;&nbsp;&nbsp; server_name www;<br><br>&nbsp;&nbsp;&nbsp; location /robots.txt {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alias /path/to/the/file1;<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>server {<br>&nbsp;&nbsp;&nbsp; listen 80;<br>&nbsp;&nbsp;&nbsp; server_name server2;<br><br>&nbsp;&nbsp;&nbsp; location /robots.txt {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alias /path/to/the/file2;<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br><br>Ray.<br><br><br>On Fri, May 21, 2010 at 9:43 PM, Ilan Berkner &lt;iberkner@gmail.com&gt; wrote:<br>&gt; Hi All,<br>&gt; We have 2 sub-domain groups setup for processing incoming requests:<br>&gt; 1. "server2"<br>&gt; 2. all others, for example: "www"<br>&gt; The 2 sub-domains share the same directory for delivery of static files<br>&gt; (html, images, swf, etc.) but use different PHP backends.<br>&gt; Is there a way, using nginx configuration to load a different robots.txt<br>&gt; file when requested for one group vs. the other?<br>&gt; Thanks!<br>&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; nginx mailing list<br>&gt; nginx@nginx.org<br>&gt; http://nginx.org/mailman/listinfo/nginx<br>&gt;<br>&gt;<br><br><br><br>------------------------------<br><br>Message: 2<br>Date: Fri, 21 May 2010 21:53:45 +0800<br>From: Ray &lt;gunblad3@gmail.com&gt;<br>To: nginx@nginx.org<br>Cc: nginx@sysoev.ru<br>Subject: Re: loading a different robots.txt file for a different sub<br>        domain?<br>Message-ID:<br>        &lt;AANLkTilS4qcF-LEDsGXyml1zu2YspTj6wSrRQHGq48-N@mail.gmail.com&gt;<br>Content-Type: text/plain; charset=UTF-8<br><br>Yes.<br><br>server {<br>&nbsp;&nbsp;&nbsp; listen 80 default;<br>&nbsp;&nbsp;&nbsp; server_name www;<br><br>&nbsp;&nbsp;&nbsp; location /robots.txt {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alias /path/to/the/file1;<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>server {<br>&nbsp;&nbsp;&nbsp; listen 80;<br>&nbsp;&nbsp;&nbsp; server_name server2;<br><br>&nbsp;&nbsp;&nbsp; location /robots.txt {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alias /path/to/the/file2;<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br><br>Ray.<br><br><br>On Fri, May 21, 2010 at 9:43 PM, Ilan Berkner &lt;iberkner@gmail.com&gt; wrote:<br>&gt; Hi All,<br>&gt; We have 2 sub-domain groups setup for processing incoming requests:<br>&gt; 1. "server2"<br>&gt; 2. all others, for example: "www"<br>&gt; The 2 sub-domains share the same directory for delivery of static files<br>&gt; (html, images, swf, etc.) but use different PHP backends.<br>&gt; Is there a way, using nginx configuration to load a different robots.txt<br>&gt; file when requested for one group vs. the other?<br>&gt; Thanks!<br>&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; nginx mailing list<br>&gt; nginx@nginx.org<br>&gt; http://nginx.org/mailman/listinfo/nginx<br>&gt;<br>&gt;<br><br><br><br>------------------------------<br><br>Message: 3<br>Date: Fri, 21 May 2010 10:03:10 -0400<br>From: Ilan Berkner &lt;iberkner@gmail.com&gt;<br>To: nginx@nginx.org<br>Subject: Re: loading a different robots.txt file for a different sub<br>        domain?<br>Message-ID:<br>        &lt;AANLkTikoFCyB0tcDBCeXAeO-fhYM290irFASrg9h90Q1@mail.gmail.com&gt;<br>Content-Type: text/plain; charset="iso-8859-1"<br><br>Worked like a charm, thanks!<br><br><br>On Fri, May 21, 2010 at 9:53 AM, Ray &lt;gunblad3@gmail.com&gt; wrote:<br><br>&gt; Yes.<br>&gt;<br>&gt; server {<br>&gt;&nbsp;&nbsp;&nbsp; listen 80 default;<br>&gt;&nbsp;&nbsp;&nbsp; server_name www;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp; location /robots.txt {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alias /path/to/the/file1;<br>&gt;&nbsp;&nbsp;&nbsp; }<br>&gt; }<br>&gt;<br>&gt; server {<br>&gt;&nbsp;&nbsp;&nbsp; listen 80;<br>&gt;&nbsp;&nbsp;&nbsp; server_name server2;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp; location /robots.txt {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alias /path/to/the/file2;<br>&gt;&nbsp;&nbsp;&nbsp; }<br>&gt; }<br>&gt;<br>&gt;<br>&gt; Ray.<br>&gt;<br>&gt;<br>&gt; On Fri, May 21, 2010 at 9:43 PM, Ilan Berkner &lt;iberkner@gmail.com&gt; wrote:<br>&gt; &gt; Hi All,<br>&gt; &gt; We have 2 sub-domain groups setup for processing incoming requests:<br>&gt; &gt; 1. "server2"<br>&gt; &gt; 2. all others, for example: "www"<br>&gt; &gt; The 2 sub-domains share the same directory for delivery of static files<br>&gt; &gt; (html, images, swf, etc.) but use different PHP backends.<br>&gt; &gt; Is there a way, using nginx configuration to load a different robots.txt<br>&gt; &gt; file when requested for one group vs. the other?<br>&gt; &gt; Thanks!<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; _______________________________________________<br>&gt; &gt; nginx mailing list<br>&gt; &gt; nginx@nginx.org<br>&gt; &gt; http://nginx.org/mailman/listinfo/nginx<br>&gt; &gt;<br>&gt; &gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; nginx mailing list<br>&gt; nginx@nginx.org<br>&gt; http://nginx.org/mailman/listinfo/nginx<br>&gt;<br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: &lt;http://nginx.org/pipermail/nginx/attachments/20100521/dc7ff991/attachment-0001.html&gt;<br><br>------------------------------<br><br>Message: 4<br>Date: Fri, 21 May 2010 18:24:01 +0400<br>From: Igor Sysoev &lt;igor@sysoev.ru&gt;<br>To: nginx@nginx.org<br>Subject: Re: loading a different robots.txt file for a different sub<br>        domain?<br>Message-ID: &lt;20100521142401.GD72328@rambler-co.ru&gt;<br>Content-Type: text/plain; charset=koi8-r<br><br>On Fri, May 21, 2010 at 10:03:10AM -0400, Ilan Berkner wrote:<br><br>&gt; Worked like a charm, thanks!<br><br>You may also use:<br>&nbsp;&nbsp; location = /robots.txt {<br>&nbsp;<br>&gt; On Fri, May 21, 2010 at 9:53 AM, Ray &lt;gunblad3@gmail.com&gt; wrote:<br>&gt; <br>&gt; &gt; Yes.<br>&gt; &gt;<br>&gt; &gt; server {<br>&gt; &gt;&nbsp;&nbsp;&nbsp; listen 80 default;<br>&gt; &gt;&nbsp;&nbsp;&nbsp; server_name www;<br>&gt; &gt;<br>&gt; &gt;&nbsp;&nbsp;&nbsp; location /robots.txt {<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alias /path/to/the/file1;<br>&gt; &gt;&nbsp;&nbsp;&nbsp; }<br>&gt; &gt; }<br>&gt; &gt;<br>&gt; &gt; server {<br>&gt; &gt;&nbsp;&nbsp;&nbsp; listen 80;<br>&gt; &gt;&nbsp;&nbsp;&nbsp; server_name server2;<br>&gt; &gt;<br>&gt; &gt;&nbsp;&nbsp;&nbsp; location /robots.txt {<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alias /path/to/the/file2;<br>&gt; &gt;&nbsp;&nbsp;&nbsp; }<br>&gt; &gt; }<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; Ray.<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; On Fri, May 21, 2010 at 9:43 PM, Ilan Berkner &lt;iberkner@gmail.com&gt; wrote:<br>&gt; &gt; &gt; Hi All,<br>&gt; &gt; &gt; We have 2 sub-domain groups setup for processing incoming requests:<br>&gt; &gt; &gt; 1. "server2"<br>&gt; &gt; &gt; 2. all others, for example: "www"<br>&gt; &gt; &gt; The 2 sub-domains share the same directory for delivery of static files<br>&gt; &gt; &gt; (html, images, swf, etc.) but use different PHP backends.<br>&gt; &gt; &gt; Is there a way, using nginx configuration to load a different robots.txt<br>&gt; &gt; &gt; file when requested for one group vs. the other?<br>&gt; &gt; &gt; Thanks!<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; _______________________________________________<br>&gt; &gt; &gt; nginx mailing list<br>&gt; &gt; &gt; nginx@nginx.org<br>&gt; &gt; &gt; http://nginx.org/mailman/listinfo/nginx<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt;<br>&gt; &gt; _______________________________________________<br>&gt; &gt; nginx mailing list<br>&gt; &gt; nginx@nginx.org<br>&gt; &gt; http://nginx.org/mailman/listinfo/nginx<br>&gt; &gt;<br><br>&gt; _______________________________________________<br>&gt; nginx mailing list<br>&gt; nginx@nginx.org<br>&gt; http://nginx.org/mailman/listinfo/nginx<br><br><br>-- <br>Igor Sysoev<br>http://sysoev.ru/en/<br><br><br><br>------------------------------<br><br>Message: 5<br>Date: Fri, 21 May 2010 10:07:00 -0700<br>From: Avleen Vig &lt;avleen@gmail.com&gt;<br>To: nginx@sysoev.ru<br>Subject: nginx 0day exploit for nginx + fastcgi PHP<br>Message-ID:<br>        &lt;AANLkTilDMa5NUSbwpGgBn3TDeG46ft-2fPwU9obxN8hA@mail.gmail.com&gt;<br>Content-Type: text/plain; charset=ISO-8859-1<br><br>This is currently doing the rounds, so I thought it pertinent to post<br>it here too.<br><br>http://www.webhostingtalk.com/showthread.php?p=6807475#post6807475<br><br>I don't know what nginx should do to fix this, but there are two<br>workarounds given.<br>If you allow file uploads (especially things like images) and use PHP<br>FastCGI in the back end, you should take a loot at this now.<br>The exploit allows for any arbitrary file which is uploaded, to be<br>executed as PHP.<br><br><br><br>------------------------------<br><br>Message: 6<br>Date: Fri, 21 May 2010 10:27:14 -0700<br>From: Avleen Vig &lt;avleen@gmail.com&gt;<br>To: nginx@sysoev.ru<br>Subject: Re: nginx 0day exploit for nginx + fastcgi PHP<br>Message-ID:<br>        &lt;AANLkTik8cJNceX3z-E7NLs4ZYEZ11Y51XUETLVO_7MAA@mail.gmail.com&gt;<br>Content-Type: text/plain; charset=ISO-8859-1<br><br>On Fri, May 21, 2010 at 10:07 AM, Avleen Vig &lt;avleen@gmail.com&gt; wrote:<br>&gt; This is currently doing the rounds, so I thought it pertinent to post<br>&gt; it here too.<br>&gt;<br>&gt; http://www.webhostingtalk.com/showthread.php?p=6807475#post6807475<br>&gt;<br>&gt; I don't know what nginx should do to fix this, but there are two<br>&gt; workarounds given.<br>&gt; If you allow file uploads (especially things like images) and use PHP<br>&gt; FastCGI in the back end, you should take a loot at this now.<br>&gt; The exploit allows for any arbitrary file which is uploaded, to be<br>&gt; executed as PHP.<br><br>I should add that this isn't a bug in the traditional broken-code sense.<br>More that this is a gaping configuration hole which is now widely<br>published, and could lead to many people being exploited.<br><br><br><br>------------------------------<br><br>Message: 7<br>Date: Fri, 21 May 2010 10:28:16 -0700<br>From: Michael Shadle &lt;mike503@gmail.com&gt;<br>To: nginx@nginx.org<br>Cc: nginx@sysoev.ru<br>Subject: Re: nginx 0day exploit for nginx + fastcgi PHP<br>Message-ID:<br>        &lt;AANLkTimrR_aMpB2hhatNaDRkixYO-8LQDOmw5zPOoRrH@mail.gmail.com&gt;<br>Content-Type: text/plain; charset=UTF-8<br><br>Question is, what functionality is lost by changing<br><br>cgi.fix_pathinfo = 0<br><br>Looks like the other workaround is something like this:<br><br>if ( $fastcgi_script_name ~ \..*\/.*php ) {<br>&nbsp;return 403;<br>}<br><br>Which i basically saying what exactly? If there is a period and slash<br>somewhere prior to the last "filename" to return a 403?<br><br>Ideally while this is being thought out it would be cool to fix the<br>common "no input file specified" issue that a lot of people have -<br>have it return a 404 instead. Not sure if it's a simple php.ini change<br>(perhaps the path info?) or change fastcgi_param REDIRECT_STATUS 200?<br><br><br>On Fri, May 21, 2010 at 10:07 AM, Avleen Vig &lt;avleen@gmail.com&gt; wrote:<br>&gt; This is currently doing the rounds, so I thought it pertinent to post<br>&gt; it here too.<br>&gt;<br>&gt; http://www.webhostingtalk.com/showthread.php?p=6807475#post6807475<br>&gt;<br>&gt; I don't know what nginx should do to fix this, but there are two<br>&gt; workarounds given.<br>&gt; If you allow file uploads (especially things like images) and use PHP<br>&gt; FastCGI in the back end, you should take a loot at this now.<br>&gt; The exploit allows for any arbitrary file which is uploaded, to be<br>&gt; executed as PHP.<br>&gt;<br>&gt; _______________________________________________<br>&gt; nginx mailing list<br>&gt; nginx@nginx.org<br>&gt; http://nginx.org/mailman/listinfo/nginx<br>&gt;<br><br><br><br>------------------------------<br><br>Message: 8<br>Date: Fri, 21 May 2010 10:28:16 -0700<br>From: Michael Shadle &lt;mike503@gmail.com&gt;<br>To: nginx@nginx.org<br>Cc: nginx@sysoev.ru<br>Subject: Re: nginx 0day exploit for nginx + fastcgi PHP<br>Message-ID:<br>        &lt;AANLkTimrR_aMpB2hhatNaDRkixYO-8LQDOmw5zPOoRrH@mail.gmail.com&gt;<br>Content-Type: text/plain; charset=UTF-8<br><br>Question is, what functionality is lost by changing<br><br>cgi.fix_pathinfo = 0<br><br>Looks like the other workaround is something like this:<br><br>if ( $fastcgi_script_name ~ \..*\/.*php ) {<br>&nbsp;return 403;<br>}<br><br>Which i basically saying what exactly? If there is a period and slash<br>somewhere prior to the last "filename" to return a 403?<br><br>Ideally while this is being thought out it would be cool to fix the<br>common "no input file specified" issue that a lot of people have -<br>have it return a 404 instead. Not sure if it's a simple php.ini change<br>(perhaps the path info?) or change fastcgi_param REDIRECT_STATUS 200?<br><br><br>On Fri, May 21, 2010 at 10:07 AM, Avleen Vig &lt;avleen@gmail.com&gt; wrote:<br>&gt; This is currently doing the rounds, so I thought it pertinent to post<br>&gt; it here too.<br>&gt;<br>&gt; http://www.webhostingtalk.com/showthread.php?p=6807475#post6807475<br>&gt;<br>&gt; I don't know what nginx should do to fix this, but there are two<br>&gt; workarounds given.<br>&gt; If you allow file uploads (especially things like images) and use PHP<br>&gt; FastCGI in the back end, you should take a loot at this now.<br>&gt; The exploit allows for any arbitrary file which is uploaded, to be<br>&gt; executed as PHP.<br>&gt;<br>&gt; _______________________________________________<br>&gt; nginx mailing list<br>&gt; nginx@nginx.org<br>&gt; http://nginx.org/mailman/listinfo/nginx<br>&gt;<br><br><br><br>------------------------------<br><br>Message: 9<br>Date: Fri, 21 May 2010 21:33:02 +0400<br>From: Igor Sysoev &lt;igor@sysoev.ru&gt;<br>To: nginx@nginx.org<br>Subject: Re: nginx 0day exploit for nginx + fastcgi PHP<br>Message-ID: &lt;20100521173302.GF72328@rambler-co.ru&gt;<br>Content-Type: text/plain; charset=koi8-r<br><br>On Fri, May 21, 2010 at 10:07:00AM -0700, Avleen Vig wrote:<br><br>&gt; This is currently doing the rounds, so I thought it pertinent to post<br>&gt; it here too.<br>&gt; <br>&gt; http://www.webhostingtalk.com/showthread.php?p=6807475#post6807475<br>&gt; <br>&gt; I don't know what nginx should do to fix this, but there are two<br>&gt; workarounds given.<br>&gt; If you allow file uploads (especially things like images) and use PHP<br>&gt; FastCGI in the back end, you should take a loot at this now.<br>&gt; The exploit allows for any arbitrary file which is uploaded, to be<br>&gt; executed as PHP.<br><br>I do not see why this is treated as nginx bug ?<br>Why is anyone able at all to upload images to /scripts directory ?<br>Why does PHP have cgi.fix_pathinfo option ?<br>BTW, I'm just curious how does lighttpd resolve this issue ?<br><br>Also instead of<br><br>if ( $fastcgi_script_name ~ \..*\/.*php ) {<br>&nbsp;&nbsp;&nbsp; return 403;<br>}<br><br>it should be worked around as<br><br>location ~ \..*/.*\.php$ {<br>&nbsp;&nbsp;&nbsp; return 403;<br>}<br><br>location ~ \.php$ {<br>&nbsp;&nbsp;&nbsp; return 403;<br>}<br><br><br>-- <br>Igor Sysoev<br>http://sysoev.ru/en/<br><br><br><br>------------------------------<br><br>_______________________________________________<br>nginx mailing list<br>nginx@nginx.org<br>http://nginx.org/mailman/listinfo/nginx<br><br><br>End of nginx Digest, Vol 7, Issue 47<br>************************************<br></div></includetail></div>