Welcome! Log In Create A New Profile

Advanced

Should we add php-fpm for each Virtual Host or in Global Configuration ?

August 11, 2015 10:37PM
This is my configuration for my Virtual Host. I am not sure, but is this the ideal way of defining things ?

For every domain / sub-domain, i'm adding a location ~/.php directive. Should i add it in the global nginx.conf itself instead of specifying individually for each domain i add ?

Sample Configuration :-


server {
listen 80;
server_name example.com;

location / {
root /var/www/example.com;
index index.php;

}


location ~ \.php$ {
root /var/www/example.com/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi_read_timeout 30000;
# fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}

server {
listen 80;
server_name www.example.net;

location / {
root /var/www/example.net/;
index index.php;

}


location ~ \.php$ {
root /var/www/example.net/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi_read_timeout 30000;
# fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
Subject Author Posted

Should we add php-fpm for each Virtual Host or in Global Configuration ?

sunzeal August 11, 2015 10:37PM

Re: Should we add php-fpm for each Virtual Host or in Global Configuration ?

Anoop Alias August 12, 2015 04:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 116
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready