diff --git a/README.md b/README.md index ded28ac..403c75c 100644 --- a/README.md +++ b/README.md @@ -2,31 +2,28 @@ This repository contains the Nginx configurations used within the series [Hosting WordPress Yourself](https://deliciousbrains.com/hosting-wordpress-setup-secure-virtual-server/). It contains best practices from various sources, including the [WordPress Codex](https://codex.wordpress.org/Nginx) and [H5BP](https://github.com/h5bp/server-configs-nginx). The following example sites are included: -* fastcgi-cache.com - WordPress with [FastCGI caching](https://deliciousbrains.com/hosting-wordpress-yourself-server-monitoring-caching/#page-cache) * multisite-subdirectory.com - WordPress multisite install using subdirectories * multisite-subdomain.com - WordPress multisite install using subdomains * single-site.com - WordPress single site install * single-site-with-caching.com - WordPress single site install with FastCGI caching * single-site-no-ssl.com - WordPress single site install (no SSL or page caching) -Looking for a modern hosting environment provisioned using Ansible? Check out [WordPress Ansible](https://github.com/A5hleyRich/wordpress-ansible). - ## Usage ### PHP configuration -The php-fpm pool configuration is located in `global/php-pool.conf` and defaults to PHP 7.1. It will need modified if you want the default php-fpm pool service to be a different PHP version. Additional PHP version upstream definitions can be added to the `/upstreams` folder (a PHP 7.0 sample is provided there). You can either use the default pool using `$upstream` in your nginx configurations or the specific upstream definition (i.e. php71, php70) setup by your custom upstream definitions. +The php-fpm pool configuration is located in `global/php-pool.conf` and defaults to PHP 7.4. It will need modifying if you want the default php-fpm pool service to be a different PHP version. Additional PHP version upstream definitions can be added to the `/upstreams` folder (a PHP 7.3 sample is provided there). You can either use the default pool using `$upstream` in your nginx configurations or the specific upstream definition (i.e. php73, php72) setup by your custom upstream definitions. -For example, currently the nginx configuration for `singlesite.com` has the following set for php requests: +For example, currently the nginx configuration for `single-site.com` has the following set for php requests: ``` fastcgi_pass $upstream ``` -You could change that to the following to use the php 7.0 php service instead (assuming that php7.0-fpm service is running). +You could change that to the following to use the php 7.3 PHP service instead (assuming that php7.3-fpm service is running). ``` -fastcgi_pass php70 +fastcgi_pass php73 ``` This effectively allows you to have different server blocks execute different versions of PHP if needed. @@ -49,7 +46,7 @@ Symlink the default file from _sites-available_ to _sites-enabled_, which will s Copy one of the example configurations from _sites-available_ to _sites-available/yourdomain.com_: -`sudo cp /etc/nginx/sites-available/singlesite.com /etc/nginx/sites-available/yourdomain.com` +`sudo cp /etc/nginx/sites-available/single-site.com /etc/nginx/sites-available/yourdomain.com` Edit the site accordingly, paying close attention to the server name and paths. diff --git a/sites-available/.gitignore b/sites-available/.gitignore index be997d3..6abde77 100644 --- a/sites-available/.gitignore +++ b/sites-available/.gitignore @@ -4,7 +4,6 @@ # Except !.gitignore !default -!fastcgi-cache.com !multisite-subdirectory.com !multisite-subdomain.com !single-site-no-ssl.com diff --git a/sites-available/fastcgi-cache.com b/sites-available/fastcgi-cache.com deleted file mode 100644 index 5428a80..0000000 --- a/sites-available/fastcgi-cache.com +++ /dev/null @@ -1,66 +0,0 @@ -# Define path to cache and memory zone. The memory zone should be unique. -# keys_zone=fastcgi-cache.com:100m creates the memory zone and sets the maximum size in MBs. -# inactive=60m will remove cached items that haven't been accessed for 60 minutes or more. -fastcgi_cache_path /sites/fastcgi-cache.com/cache levels=1:2 keys_zone=fastcgi-cache.com:100m inactive=60m; - -server { - # Ports to listen on - listen 80; - listen [::]:80; - - # Server name to listen for - server_name fastcgi-cache.com; - - # Path to document root - root /sites/fastcgi-cache.com/public; - - # File to be used as index - index index.php; - - # Overrides logs defined in nginx.conf, allows per site logs. - access_log /sites/fastcgi-cache.com/logs/access.log; - error_log /sites/fastcgi-cache.com/logs/error.log; - - # Default server block rules - include global/server/defaults.conf; - - # Fastcgi cache rules - include global/server/fastcgi-cache.conf; - - location / { - try_files $uri $uri/ /index.php?$args; - } - - location ~ \.php$ { - try_files $uri =404; - include global/fastcgi-params.conf; - - # Use the php pool defined in the upstream variable. - # See global/php-pool.conf for definition. - fastcgi_pass $upstream; - - # Skip cache based on rules in global/server/fastcgi-cache.conf. - fastcgi_cache_bypass $skip_cache; - fastcgi_no_cache $skip_cache; - - # Define memory zone for caching. Should match key_zone in fastcgi_cache_path above. - fastcgi_cache fastcgi-cache.com; - - # Define caching time. - fastcgi_cache_valid 60m; - } - - # Uncomment if using the fastcgi_cache_purge module and Nginx Helper plugin (https://wordpress.org/plugins/nginx-helper/) - # location ~ /purge(/.*) { - # fastcgi_cache_purge fastcgi-cache.com "$scheme$request_method$host$1"; - # } -} - -# Redirect www to non-www -server { - listen 80; - listen [::]:80; - server_name www.fastcgi-cache.com; - - return 301 $scheme://fastcgi-cache.com$request_uri; -} \ No newline at end of file