Global PHP Rule
Jim Ohlstein
jim.ohlstein at gmail.com
Mon May 4 04:41:04 MSD 2009
Mathew Davies wrote:
> Hi,
>
> Is there a way to specify a global PHP location rule? As you can see
> below, the PHP block is repeated which is no good.
Best as I can tell from
http://wiki.nginx.org/NginxHttpFcgiModule#fastcgi_pass, that's they way
it is.
fastcgi_pass
syntax: fastcgi_pass fastcgi-server
default: none
context: location, if in location
Directive assigns the port or socket on which the FastCGI-server is
listening. Port can be indicated by itself or as an address and
port, for example:
fastcgi_pass localhost:9000;
using a Unix domain socket:
fastcgi_pass unix:/tmp/fastcgi.socket;
>
> # domain1.tld
> server
> {
> server_name domain1.tld;
> root html/domain1;
>
> location ~ \.php$
> {
> fastcgi_pass 127.0.0.1:9000 <http://127.0.0.1:9000>;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> include fastcgi_params;
> }
> }
>
> # domain2.tld
> server
> {
> server_name domain2.tld;
> root html/domain2;
>
> location ~ \.php$
> {
> fastcgi_pass 127.0.0.1:9000 <http://127.0.0.1:9000>;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> include fastcgi_params;
> }
> }
>
> Thank You.
Jim
More information about the nginx
mailing list