Skip to content

Instantly share code, notes, and snippets.

@joelworsham
Created October 23, 2014 18:13
Show Gist options
  • Save joelworsham/520ad2dabd44eb96ba17 to your computer and use it in GitHub Desktop.
Save joelworsham/520ad2dabd44eb96ba17 to your computer and use it in GitHub Desktop.
################################################################
# Example configuration file for nginx
#
# To add a new local WordPress domain to your environment, copy
# this file using a filename that matches the domain you wish to
# setup. For example - mylocaldomain.com.conf would be an ideal
# filename for http://mylocaldomain.com
#
# Once copied, you will need to modify two settings in the server
# configuration provided:
#
# 1. server_name - Change the server_name parameter in the server
# configuration below to mylocaldomain.com
# 2. root - Change root to the full path that your WordPress
# site lives at inside Vagrant. An example would be
# /srv/www/mylocal-wordpress
#
# You do not need to worry about modifying the listen or include
# parameters as those are the same across all test sites for most
# basic WordPress configurations.
#
# Once your new domain has been added, make sure to restart the
# nginx process by running `vagrant provision` in your local
# environment or `sudo service nginx restart` after `vagrant ssh`
################################################################
server {
# Determines the port number that nginx will listen to for this
# server configuration. 80 is the default http port.
listen 80;
# Listen for HTTPS requests as well
listen 443 ssl;
# Tells nginx what domain name should trigger this configuration. If
# you would like multiple domains or subdomains, they can be space
# delimited here. See http://nginx.org/en/docs/http/server_names.html
server_name example.dev;
# Tells nginx which directory the files for this domain are located
root /srv/www/example/htdocs;
# Includes a basic WordPress configuration to help with the common
# rules needed by a web server to deal with WordPress properly.
include /etc/nginx/nginx-wp-common.conf;
# Directives to send expires headers and turn off 404 error logging.
location ~* .(png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
try_files $uri $uri/ @production @productionwww;
}
location @production {
resolver 8.8.8.8;
proxy_pass http://example.org/$uri;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment