diff --git a/apps/drupal/admin_basic_auth.conf b/apps/drupal/admin_basic_auth.conf index cc796ce0..50381944 100644 --- a/apps/drupal/admin_basic_auth.conf +++ b/apps/drupal/admin_basic_auth.conf @@ -8,5 +8,5 @@ location ^~ /admin { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; } diff --git a/apps/drupal/drupal.conf b/apps/drupal/drupal.conf index 71578b3c..8619999e 100644 --- a/apps/drupal/drupal.conf +++ b/apps/drupal/drupal.conf @@ -26,7 +26,7 @@ location / { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## If proxying to apache comment the two lines above and ## uncomment the two lines below. @@ -50,7 +50,7 @@ location / { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## If proxying to apache comment the two lines above and ## uncomment the two lines below. @@ -199,7 +199,7 @@ location / { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## If proxying to apache comment the two lines above and ## uncomment the two lines below. @@ -232,7 +232,7 @@ location / { location @drupal { ## Include the FastCGI config. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## FastCGI microcache. include apps/drupal/microcache_fcgi.conf; @@ -259,7 +259,7 @@ location @drupal-no-args { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_no_args_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## FastCGI microcache. include apps/drupal/microcache_fcgi.conf; diff --git a/apps/drupal/drupal_boost.conf b/apps/drupal/drupal_boost.conf index 4a0053d3..093bf2e3 100644 --- a/apps/drupal/drupal_boost.conf +++ b/apps/drupal/drupal_boost.conf @@ -26,7 +26,7 @@ location / { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## If proxying to apache comment the two lines above and ## uncomment the line below. @@ -50,7 +50,7 @@ location / { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## If proxying to apache comment the two lines above and ## uncomment the line below. @@ -192,7 +192,7 @@ location / { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## If proxying to apache comment the two lines above and ## uncomment the line below. @@ -263,7 +263,7 @@ location @cache { location @drupal { ## Include the FastCGI config. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## FCGI microcache for authenticated users also. include apps/drupal/microcache_fcgi_auth.conf; @@ -285,7 +285,7 @@ location @drupal-no-args { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_no_args_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## FCGI microcache for authenticated users also. include apps/drupal/microcache_fcgi_auth.conf; @@ -369,7 +369,7 @@ location ~* ^.+\.php$ { ## Boost stats. location = /boost_stats.php { - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## To use Apache for serving PHP uncomment the line bellow and ## comment out the above. #proxy_pass http://phpapache; diff --git a/apps/drupal/drupal_boost_escaped.conf b/apps/drupal/drupal_boost_escaped.conf index 68996ab5..3a4cc209 100644 --- a/apps/drupal/drupal_boost_escaped.conf +++ b/apps/drupal/drupal_boost_escaped.conf @@ -29,7 +29,7 @@ location / { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## If proxying to apache comment the two lines above and ## uncomment the line below. @@ -53,7 +53,7 @@ location / { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## If proxying to apache comment the two lines above and ## uncomment the line below. @@ -195,7 +195,7 @@ location / { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## If proxying to apache comment the two lines above and ## uncomment the line below. @@ -267,7 +267,7 @@ location @cache { location @drupal { ## Include the FastCGI config. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## FCGI microcache for authenticated users also. include apps/drupal/microcache_fcgi_auth.conf; @@ -289,7 +289,7 @@ location @drupal-no-args { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_no_args_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## FCGI microcache for authenticated users also. include apps/drupal/microcache_fcgi_auth.conf; @@ -373,7 +373,7 @@ location ~* ^.+\.php$ { ## Boost stats. location = /boost_stats.php { - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## To use Apache for serving PHP uncomment the line bellow and ## comment out the above. #proxy_pass http://phpapache; diff --git a/apps/drupal/drupal_cron_update.conf b/apps/drupal/drupal_cron_update.conf index 55500e97..ff890438 100644 --- a/apps/drupal/drupal_cron_update.conf +++ b/apps/drupal/drupal_cron_update.conf @@ -3,7 +3,7 @@ ## XMLRPC. Comment out if not enabled. location = /xmlrpc.php { - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; # To use Apache for serving PHP uncomment the line bellow and # comment out the above. #proxy_pass http://phpapache; @@ -16,7 +16,7 @@ location = /cron.php { if ($not_allowed_cron) { return 404 /; } - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## To use Apache for serving PHP uncomment the line bellow and ## comment out the above. #proxy_pass http://phpapache; @@ -24,7 +24,7 @@ location = /cron.php { ## Run the update from the web interface with Drupal 7. location = /authorize.php { - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## To use Apache for serving PHP uncomment the line bellow and ## comment out the above. #proxy_pass http://phpapache; @@ -33,7 +33,7 @@ location = /authorize.php { location = /update.php { auth_basic "Restricted Access"; # auth realm auth_basic_user_file .htpasswd-users; # htpasswd file - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## To use Apache for serving PHP uncomment the line bellow and ## comment out the above. #proxy_pass http://phpapache; diff --git a/apps/drupal/drupal_escaped.conf b/apps/drupal/drupal_escaped.conf index 5cf812a8..0ffdd8b1 100644 --- a/apps/drupal/drupal_escaped.conf +++ b/apps/drupal/drupal_escaped.conf @@ -29,7 +29,7 @@ location / { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## If proxying to apache comment the two lines above and ## uncomment the line below. @@ -53,7 +53,7 @@ location / { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## If proxying to apache comment the two lines above and ## uncomment the line below. @@ -201,7 +201,7 @@ location / { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## If proxying to apache comment the two lines above and ## uncomment the line below. @@ -233,7 +233,7 @@ location / { location @drupal { ## Include the FastCGI config. include apps/drupal/fastcgi_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## FastCGI microcache. include apps/drupal/microcache_fcgi.conf; @@ -259,7 +259,7 @@ location @drupal-no-args { ## Include the specific FastCGI configuration. This is for a ## FCGI backend like php-cgi or php-fpm. include apps/drupal/fastcgi_no_args_drupal.conf; - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; ## FastCGI microcache. include apps/drupal/microcache_fcgi.conf; diff --git a/apps/drupal/drupal_install.conf b/apps/drupal/drupal_install.conf index 1f4f11bf..60078867 100644 --- a/apps/drupal/drupal_install.conf +++ b/apps/drupal/drupal_install.conf @@ -5,12 +5,12 @@ location = /install.php { auth_basic "Restricted Access"; # auth realm auth_basic_user_file .htpasswd-users; # htpasswd file - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; } ## This is for drupal 8. There's a new location for the install file. location = /core/install.php { auth_basic "Restricted Access"; # auth realm auth_basic_user_file .htpasswd-users; # htpasswd file - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; } diff --git a/php_fpm_status_vhost.conf b/php_fpm_status_vhost.conf index 55a4b4e9..3d6c8e9c 100644 --- a/php_fpm_status_vhost.conf +++ b/php_fpm_status_vhost.conf @@ -64,7 +64,7 @@ location = /fpm-status-drei { if ($dont_show_fpm_status) { return 404; } - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; access_log off; } @@ -74,6 +74,6 @@ location = /ping-drei { if ($dont_show_fpm_status) { return 404; } - fastcgi_pass phpcgi; + fastcgi_pass $custom_upstream; access_log off; } diff --git a/sites-available/000-default b/sites-available/000-default index 59622793..1d1cf3c4 100644 --- a/sites-available/000-default +++ b/sites-available/000-default @@ -4,6 +4,9 @@ ### a suggestion by Maxim Dounin. Also suggested in ### http://nginx.org/en/docs/http/request_processing.html#how_to_prevent_undefined_server_names. server { + ## Set upstream. + set $custom_upstream phpcgi; + listen 80 default_server; # IPv4 ## Socket options can only be specified once, hence the different ## address for the 'default' server. diff --git a/sites-available/example.com.conf b/sites-available/example.com.conf index 9da0cd24..9b79e8e5 100644 --- a/sites-available/example.com.conf +++ b/sites-available/example.com.conf @@ -22,6 +22,7 @@ server { listen [fe80::202:b3ff:fe1e:8330]:80 ipv6only=on; server_name example.com; + set $custom_upstream phpcgi_examplecom; limit_conn arbeit 32; ## Access and error logs. @@ -133,6 +134,7 @@ server { ## Uncomment the line below if you're using SPDY. #listen [fe80::202:b3ff:fe1e:8329]:443 ssl spdy ipv6only=on; + set $custom_upstream phpcgi_examplecom; server_name www.example.com; ## Keep alive timeout set to a greater value for SSL/TLS. @@ -161,6 +163,7 @@ server { ## Uncomment the line below if you're using SPDY. #listen [fe80::202:b3ff:fe1e:8330]:443 ssl spdy ipv6only=on; + set $custom_upstream phpcgi_examplecom; server_name example.com; limit_conn arbeit 32; diff --git a/upstream_phpcgi_unix.conf b/upstream_phpcgi_unix.conf index ec3a80b2..b2a774c6 100644 --- a/upstream_phpcgi_unix.conf +++ b/upstream_phpcgi_unix.conf @@ -23,6 +23,13 @@ upstream phpcgi { keepalive 5; } +## Demo upstream for example.com vhost +upstream phpcgi_examplecom { + least_conn; + server unix:/var/run/php-fpm-examplecom.sock; + keepalive 5; +} + ## Add a third pool as a fallback. Note that this requires php-cgi ## side by side php-fpm. If you don't have it installed comment it ## out.