<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Hello, Thank you both for your answer.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>I did read the page http://nginx.org/en/docs/ngx_core_module.html#include but I sometimes get confused how to put things in order exactly.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif;
background-color: transparent; font-style: normal;"><span>I removed the root stanza in the location block.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>As for fastcgi_params I already have the line</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>fastcgi_param SCRIPT_NAME $fastcgi_script_name;</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span><br></span></div><div
style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>which looks like the one you wrote</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">in your my_fastcgi_params</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">What is the
difference between those two ? I didn't see <span>SCRIPT_NAME in the </span>HttpFastcgiModule documentation whereas SCRIPT_FILENAME is defined by "Parameter SCRIPT_FILENAME is used by PHP for determining the name of script to execute"</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Also, where should I put my include files ? It seems that /etc/nginx is the default location. Or you put them in another directory ?</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif;
background-color: transparent; font-style: normal;">Cheers<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1"> <font face="Arial" size="2"> <b><span style="font-weight:bold;">De :</span></b> wishmaster <artemrts@ukr.net><br> <b><span style="font-weight: bold;">À :</span></b> nginx@nginx.org <br><b><span style="font-weight: bold;">Cc :</span></b> "nginx@nginx.org" <nginx@nginx.org> <br> <b><span style="font-weight: bold;">Envoyé le :</span></b> Mardi 6 août 2013 10h10<br> <b><span style="font-weight:
bold;">Objet :</span></b> Re: Avice for my vhost configuration<br> </font> </div> <div class="y_msg_container"><br> --- Original message ---<br>From: "Mik J" <<a ymailto="mailto:mikydevel@yahoo.fr" href="mailto:mikydevel@yahoo.fr">mikydevel@yahoo.fr</a>><br>Date: 6 August 2013, 00:44:37<br><br>> Hello,<br>> <br>> I plan to configure my nginx server with a couple of vhosts.<br>> <br>> For each of them I want:<br>> <br>> - to use php<br>> <br>> - deny access begining by a dot<br>> <br>> - not logging access to favicon<br>> <br>> So my configuration would look like that<br>> <br>> server {<br>> ...<br>> location ~ \.php$ {<br>> root /var/www/htdocs/sites/expertinet;<br>> fastcgi_pass unix:/tmp/php.sock;<br>> # fastcgi_pass
127.0.0.1:9000;<br>> fastcgi_index index.php;<br>> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br>> include <br>> fastcgi_params;<br>> }<br>> <br>> location ~ /\. {<br>> access_log off;<br>> log_not_found off;<br>> deny all;<br>> }<br>> <br>> location = /favicon.ico {<br>> return 204;<br>> access_log off;<br>> log_not_found off;<br>> expires 30d;<br>> }<br>> <br>> }<br>> This in each of my virtual host configuration. This is very redundant.<br>> <br>> For example if I want to use tcp socket for fastcgi_pass, I need to edit every single vhost configuration.<br>> <br>> What are you advices to avoid this ? What is the recommended practice ?<br>> <br>> Someone adviced my to use include... Could you show me an example ?<br> <br> You must read docs.
<a href="http://nginx.org/en/docs/ngx_core_module.html#include" target="_blank">http://nginx.org/en/docs/ngx_core_module.html#include</a><br><br>For you:<br><br>> location ~ \.php$ {<br>> root /var/www/htdocs/sites/expertinet; <- you should avoid this,<br>read <a href="http://wiki.nginx.org/Pitfalls" target="_blank">http://wiki.nginx.org/Pitfalls</a><br><br>include my_fastcgi_params;<br>> include <br>> fastcgi_params;<br>> }<br><br>in my_fastcgi_params:<br><br>fastcgi_pass unix:/tmp/php.sock;<br># fastcgi_pass 127.0.0.1:9000;<br>fastcgi_index index.php;<br>fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br><br>--<br>Cheers,<br><br></div> </div> </div> </blockquote></div> </div></body></html>