Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

Should we add php-fpm for each Virtual Host or in Global Configuration ? (1 reply)

$
0
0
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;
}

Viewing all articles
Browse latest Browse all 7229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>