<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yiv3539248666"><div id="yui_3_16_0_1_1447366452841_10855"><div id="yui_3_16_0_1_1447366452841_10854" style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"><div id="yiv3539248666yui_3_16_0_1_1447366452841_10196">Hello Francis,</div><div id="yiv3539248666yui_3_16_0_1_1447366452841_10194"><br clear="none"></div><div id="yiv3539248666yui_3_16_0_1_1447366452841_10192">I tried again your solution from yesterday and didn't manage to make it work<br clear="none"></div><div id="yiv3539248666yui_3_16_0_1_1447366452841_10190"><span></span></div> location = /information { rewrite ^ /index.php?x=information; }<br class="" id="yui_3_16_0_1_1447366452841_10922"> location = /index.php {<br class="" id="yui_3_16_0_1_1447366452841_10924"><div id="yui_3_16_0_1_1447366452841_10990" dir="ltr"> fastcgi_pass 127.0.0.1:9000;</div> fastcgi_param SCRIPT_FILENAME $document_root$uri;<br class="" id="yui_3_16_0_1_1447366452841_10928"> fastcgi_param QUERY_STRING $query_string;<br class="" id="yui_3_16_0_1_1447366452841_10930"> }<br class="" id="yui_3_16_0_1_1447366452841_10932"><br class="" id="yui_3_16_0_1_1447366452841_10934">and<br class="" id="yui_3_16_0_1_1447366452841_10936"><br class="" id="yui_3_16_0_1_1447366452841_10938"> location = /information {<br class="" id="yui_3_16_0_1_1447366452841_10940"><div id="yui_3_16_0_1_1447366452841_10992" dir="ltr"> fastcgi_pass 127.0.0.1:9000;</div> fastcgi_param SCRIPT_FILENAME $document_root/index.php;<br class="" id="yui_3_16_0_1_1447366452841_10944"> fastcgi_param QUERY_STRING x=information;<br class="" id="yui_3_16_0_1_1447366452841_10946"><div id="yui_3_16_0_1_1447366452841_10947" dir="ltr"> }</div><div id="yui_3_16_0_1_1447366452841_11371" dir="ltr"><br></div><div id="yui_3_16_0_1_1447366452841_11396" dir="ltr">You asked me if it's a proxy_pass or a fast_cgi pass, I guess I want a fastcgi_pass. Nginx passes the php work to php-fpm on the same server.<br></div><div id="yui_3_16_0_1_1447366452841_10864" class="yiv3539248666qtdSeparateBR"><br clear="none"><div id="yui_3_16_0_1_1447366452841_11073" dir="ltr">I know that the blocks are properly matched because whenI misconfigure the fastcgi_pass I have the bad gateway message.</div><div id="yui_3_16_0_1_1447366452841_11106" dir="ltr">When it's configured as above it displays a completely blank page.</div><div id="yui_3_16_0_1_1447366452841_11131" dir="ltr"><br></div><div id="yui_3_16_0_1_1447366452841_11133" dir="ltr">I have php-fpm configured with <br></div><div id="yui_3_16_0_1_1447366452841_11172" dir="ltr">error_log = log/php-fpm.log</div><div id="yui_3_16_0_1_1447366452841_11181" dir="ltr">log_level = notice</div><div id="yui_3_16_0_1_1447366452841_11221" dir="ltr">php_flag[display_errors] = on<br class="" id="yui_3_16_0_1_1447366452841_11223">php_admin_value[error_log] = /var/log/fpm-php.www.log<br class="" id="yui_3_16_0_1_1447366452841_11225">php_admin_flag[log_errors] = on</div><div id="yui_3_16_0_1_1447366452841_11452" dir="ltr"><br class="" id="yui_3_16_0_1_1447366452841_11227"></div><div id="yui_3_16_0_1_1447366452841_11451" dir="ltr">I don't know how to debug this blank page thing<br></div><div id="yui_3_16_0_1_1447366452841_11218" dir="ltr"><br></div><div id="yui_3_16_0_1_1447366452841_11546" dir="ltr"><br></div><div id="yui_3_16_0_1_1447366452841_11552" dir="ltr">However when the x variable can take multiple values x=information or x=something, the second solution you wrote seems to be long. If I had to implement as you suggested, I'd have</div><div id="yui_3_16_0_1_1447366452841_11614" dir="ltr"><br></div><div id="yui_3_16_0_1_1447366452841_11578" dir="ltr">location = /information { rewrite ^ /index.php?x=information; }</div><div id="yui_3_16_0_1_1447366452841_11700" dir="ltr">location = /something { rewrite ^ /index.php?x=something; }</div><div id="yui_3_16_0_1_1447366452841_11694" dir="ltr"> location = /index.php {<br class="" id="yui_3_16_0_1_1447366452841_10924"></div><div class="" id="yui_3_16_0_1_1447366452841_10990" dir="ltr"> fastcgi_pass 127.0.0.1:9000;</div> fastcgi_param SCRIPT_FILENAME $document_root$uri;<br class="" id="yui_3_16_0_1_1447366452841_10928"> fastcgi_param QUERY_STRING $query_string;<br class="" id="yui_3_16_0_1_1447366452841_10930"> }<br class="" id="yui_3_16_0_1_1447366452841_10932"><br class="" id="yui_3_16_0_1_1447366452841_10934">or<br class="" id="yui_3_16_0_1_1447366452841_10936"><br class="" id="yui_3_16_0_1_1447366452841_10938"><div id="yui_3_16_0_1_1447366452841_11774" dir="ltr">I don't know what it could be for the second solution</div><div><br></div><div id="yui_3_16_0_1_1447366452841_11830">It's much longer than</div><div class="" id="yui_3_16_0_1_1447366452841_11578" dir="ltr">location = /information { rewrite ^ /index.php?x=information; }</div><div class="" id="yui_3_16_0_1_1447366452841_11700" dir="ltr">location = /something { rewrite ^ /index.php?x=something; }</div><div id="yui_3_16_0_1_1447366452841_11924" class="" dir="ltr">Actually, if I only write this it works</div><div id="yui_3_16_0_1_1447366452841_11931" class="" dir="ltr"><br></div><div id="yui_3_16_0_1_1447366452841_11930" class="" dir="ltr">Thank you<br></div><div id="yui_3_16_0_1_1447366452841_11834"><br></div></div><div class="yiv3539248666yqt9525178913" id="yiv3539248666yqt38457"></div></div></div></div><div class=".yiv3539248666yahoo_quoted"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div dir="ltr"> <font face="Arial" size="2"> Le Mercredi 11 novembre 2015 20h45, Francis Daly <francis@daoine.org> a écrit :<br clear="none"> </font> </div> <blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;margin-top:5px;padding-left:5px;"> <br clear="none"><br clear="none"> <div class="yiv3539248666y_msg_container">On Wed, Nov 11, 2015 at 06:50:54PM +0000, Mik J wrote:<br clear="none"><br clear="none">Hi there,<br clear="none"><br clear="none">> I tried both methods but none of them worked. I'm going to look at it more in details (and display the php logs because I just had a blank page).<br clear="none"><br clear="none">First configure things so that an explicit request for<br clear="none">/index.php?x=information gives you the response that you want.<br clear="none"><br clear="none">Keep it simple, do one thing at a time.<br clear="none"><br clear="none">> Also I would like to know why the solution you're offering is a "best practice" ?At first it seems a bit heavy because I'll have a paragraph like that for every x variable (x=information, x=something).<br clear="none"><br clear="none">The original question did not have multiple x variables. A different<br clear="none">question probably gets a different answer.<br clear="none"><br clear="none">Using "rewrite" instead of "try_files" should have exactly the same<br clear="none">number of location{} blocks.<br clear="none"><br clear="none">And it avoids a presumed-unnecessary filesystem check -- what should<br clear="none">happen if the file /usr/local/nginx/htmlinformation exists on your<br clear="none">filesystem?<br clear="none"><br clear="none">Using "fastcgi_pass" and friends instead of "rewrite" should also have<br clear="none">exactly the same number of location{} blocks. And it means that nginx<br clear="none">can skip one step of processing -- if the rewrite was going to go to a<br clear="none">location which does exactly this anyway.<br clear="none"><br clear="none">It does mean that there are more words involved; but if the number of<br clear="none">location{} block is going to be big, you are probably going to generate<br clear="none">them anyway.<br clear="none"><br clear="none">> Considering also that the users URL might not look like the x variable.nginx.org/info_1234 is an internal rewrite of index.php?x=information<br clear="none"><br clear="none">I don't see the difference this makes, in the three cases in question.<br clear="none"><br clear="none">In each case you have the request, and a different string as the x= value.<br clear="none"><br clear="none">If you choose to use variables in a common location, or something like<br clear="none">that, then you will still need the mapping or request to x= value. If you<br clear="none">knew that the mapping is always "remove the first /", then you wouldn't<br clear="none">need a separate table. But you don't have that now, either.<br clear="none"><br clear="none"><br clear="none">> I tried two other solutions that workedrewrite /info_1234 /index.php?x=information;<br clear="none">> and<br clear="none">> location = /info_1234 { try_files info_1234 /index.php?x=information; }<br clear="none">> I would like to understand why your solution is better than these, why is it a best practice ?<br clear="none"><br clear="none">It means that nginx has less work to do to process the request.<br clear="none"><br clear="none">Sometime that is not the thing that you want to optimise for.<div class="yiv3539248666yqt8814806240" id="yiv3539248666yqtfd21397"><br clear="none"><br clear="none"> f<br clear="none">-- <br clear="none">Francis Daly <a rel="nofollow" shape="rect" ymailto="mailto:francis@daoine.org" target="_blank" href="mailto:francis@daoine.org">francis@daoine.org</a><br clear="none"><br clear="none">_______________________________________________<br clear="none">nginx mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:nginx@nginx.org" target="_blank" href="mailto:nginx@nginx.org">nginx@nginx.org</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a><br clear="none"></div><br clear="none"><br clear="none"></div> </blockquote> </div> </div> </div></div></body></html>