Remove redundant site and update readme

This commit is contained in:
Ashley Rich 2020-04-29 12:22:40 +01:00
parent 3f692c2f08
commit 5e02f9f701
3 changed files with 5 additions and 75 deletions

View File

@ -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: 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-subdirectory.com - WordPress multisite install using subdirectories
* multisite-subdomain.com - WordPress multisite install using subdomains * multisite-subdomain.com - WordPress multisite install using subdomains
* single-site.com - WordPress single site install * single-site.com - WordPress single site install
* single-site-with-caching.com - WordPress single site install with FastCGI caching * 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) * 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 ## Usage
### PHP configuration ### 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 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. 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_: 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. Edit the site accordingly, paying close attention to the server name and paths.

View File

@ -4,7 +4,6 @@
# Except # Except
!.gitignore !.gitignore
!default !default
!fastcgi-cache.com
!multisite-subdirectory.com !multisite-subdirectory.com
!multisite-subdomain.com !multisite-subdomain.com
!single-site-no-ssl.com !single-site-no-ssl.com

View File

@ -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;
}