• Stars
    star
    542
  • Rank 81,703 (Top 2 %)
  • Language DIGITAL Command Language
  • Created almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Nginx server configurations for WordPress

WordPress Nginx

This config kit contains the Nginx configurations used in the Install WordPress on Ubuntu 22.04 guide. It contains best practices from various sources, including the WordPress Codex and H5BP. The following example sites are included:

Usage

Site configuration

You can use these sample configurations as reference or directly by replacing your existing nginx directory. Follow the steps below to replace your existing Nginx configuration.

Backup any existing config:

sudo mv /etc/nginx /etc/nginx.backup

Copy these configs to /etc/nginx.

Symlink the default file from sites-available to sites-enabled, which will setup a catch-all server block. This will ensure unrecognised domains return a 444 response.

sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default

Copy one of the example configurations from sites-available to 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.

To enable the site, symlink the configuration into the sites-enabled directory:

sudo ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/yourdomain.com

Test the configuration:

sudo nginx -t

If the configuration passes, restart Nginx:

sudo service nginx reload

PHP configuration

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 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.3 PHP service instead (assuming that php7.3-fpm service is running).

fastcgi_pass    php73

This effectively allows you to have different server blocks execute different versions of PHP if needed.

Directory Structure

This config kit has the following structure, which is based on the conventions used by a default Nginx install on Debian:

.
├── conf.d
├── global
    └── server
├── sites-available
├── sites-enabled

conf.d - configurations for additional modules.

global - configurations within the http block.

global/server - configurations within the server block. The defaults.conf file should be included on the majority of sites, which contains sensible defaults for caching, file exclusions and security. Additional .conf files can be included as needed on a per-site basis.

sites-available - configurations for individual sites (virtual hosts).

sites-enabled - symlinks to configurations within the sites-available directory. Only sites which have been symlinked are loaded.

Recommended Site Structure

The following site structure is used throughout these configs:

.
├── yourdomain1.com
    └── cache
    └── logs
    └── public
├── yourdomain2.com
    └── cache
    └── logs
    └── public

More Repositories

1

wp-background-processing

WordPress background processing class
PHP
1,025
star
2

wp-migrate-db

WordPress plugin that exports your database, does a find and replace on URLs and file paths, then allows you to save it to your computer.
PHP
341
star
3

wp-amazon-s3-and-cloudfront

Automatically copies media uploads to Amazon S3 for delivery. Optionally configure Amazon CloudFront for even faster delivery.
JavaScript
304
star
4

wp-image-processing-queue

Resize WordPress images in the background
PHP
203
star
5

wp-migrations

WordPress library for managing database table schema upgrades and data seeding
PHP
190
star
6

sqlbuddy

phpMyAdmin alternative with a focus on usability
PHP
188
star
7

wp-queue

Job queues for WordPress
PHP
154
star
8

wp-migrate-db-pro-tweaks

Examples of using WP Migrate DB Pro's filters
PHP
98
star
9

spinupwp-composer-site

A WordPress site setup using Composer that is primed and ready to be hosted using SpinupWP.
PHP
82
star
10

better-search-replace

A simple plugin for updating URLs or other text in a database.
PHP
82
star
11

wp-plugin-build

Shell script we use to create builds of our WordPress plugins.
PHP
68
star
12

serialized-editor

A Vue.js component for editing data that has been serialized in PHP
Vue
55
star
13

wp-amazon-s3-and-cloudfront-tweaks

Examples of using Amazon S3 and CloudFront's filters
PHP
53
star
14

wpfbbotkit

A messenger bot developer framework for WordPress
PHP
51
star
15

wp-migrate-db-anonymization

An addon for WP Migrate DB Pro that anonymizes user data
PHP
46
star
16

wp-dbi-file-uploader

A basic JavaScript file uploader plugin that can upload large files
PHP
45
star
17

wp-amazon-web-services

Houses the Amazon Web Services (AWS) PHP libraries and manages access keys. Required by other AWS plugins.
PHP
42
star
18

wp-phpstorm-code-styles

Delicious Brains WordPress coding styles for PhpStorm
25
star
19

npm-scripts

SCSS
23
star
20

spinupwp-plugin

PHP
20
star
21

wp-auto-login

WordPress library for generating automatic login URLs for users
PHP
16
star
22

wp-post-types

WordPress library for registering, reading and writing custom post types.
PHP
13
star
23

spinupwp-mu-plugin

PHP
13
star
24

wp-offload-ses-lite

WP Offload SES Lite sends all outgoing WordPress emails through Amazon Simple Email Service (SES) instead of the local wp_mail() function.
PHP
13
star
25

wp-filesystem

A wrapper for the WP Filesystem
PHP
11
star
26

wp-db-backup

PHP
11
star
27

wp-post-series

WordPress library for adding a series support to posts
PHP
9
star
28

mergebot-schemas

Contains all the WordPress core, plugin and theme schemas for the Mergebot application.
PHP
9
star
29

wp-testimonials

WordPress must-use plugin for managing testimonials, importing from tweets and displaying them.
PHP
7
star
30

spinupwp-cli

The official command-line tool for SpinupWP.
PHP
6
star
31

wp-post-promoter

WordPress must-use plugin for promoting posts via email and social media.
PHP
6
star
32

spinupwp-php-sdk

The official SpinupWP PHP SDK.
PHP
5
star
33

github-gardener

Gardening of GitHub issues and pull requests
PHP
5
star
34

finance-app-trial-project

PHP
4
star
35

wordpress-ansible

Ansible playbook for provisioning WordPress servers
4
star
36

wp-cli-up

wp-cli-up
PHP
4
star
37

wp-mergebot

PHP
3
star
38

testdriiive

PHP
3
star
39

mergebot-schema-generator

Generate Mergebot schema files for WordPress plugins, themes, or core
PHP
2
star
40

woocommerce-subscriptions-renew-active

Abandoned (see below). Extends WooCommerce Subscriptions plugin to enable manual renewals of active subscriptions
PHP
2
star
41

wp-migrate-db-pro-bugs

Bug tracking for WP Migrate DB Pro beta release
2
star
42

wp-markdown

PHP
1
star
43

gp-login-with-email

GlotPress plugin to allow login with the user's email
PHP
1
star