Skip to content

Instantly share code, notes, and snippets.

@oxocode
Last active November 2, 2016 02:44

Revisions

  1. oxocode revised this gist May 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion local.domain.com.conf
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ server {
    # 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 local.domain.com *.local.domain.com ~^local.domain.com\.\d+\.\d+\.\d+\.\d+\.xip\.io$;;
    server_name local.domain.com *.local.domain.com ~^local.domain.com\.\d+\.\d+\.\d+\.\d+\.xip\.io$;

    # Tells nginx which directory the files for this domain are located

  2. oxocode revised this gist Apr 19, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion local.domain.com.conf
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ server {
    # 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 local.domain.com *.domain.com ~^local.domain.com\.\d+\.\d+\.\d+\.\d+\.xip\.io$;;
    server_name local.domain.com *.local.domain.com ~^local.domain.com\.\d+\.\d+\.\d+\.\d+\.xip\.io$;;

    # Tells nginx which directory the files for this domain are located

  3. oxocode created this gist Apr 19, 2015.
    66 changes: 66 additions & 0 deletions local.domain.com.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,66 @@
    # VVV Nginx Configuration
    # oxocode
    # - Uses proper domain.com extension for verifying
    # third party APIs are loading / ads are being served.
    # - Allows access to localhost via mobile
    # - Uses xip.io for testing RWD via mobile
    #
    # Assumptions: These rules assume that your
    # development site was created in 'local.domain.com'
    # within your vagrant public root
    #
    # Installation: Replace "domain" with the sitename

    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 local.domain.com *.domain.com ~^local.domain.com\.\d+\.\d+\.\d+\.\d+\.xip\.io$;;

    # Tells nginx which directory the files for this domain are located

    root /srv/www/local.domain.com/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.
    # Requests are limited to media files
    location ~* .(png|jpg|jpeg|gif|ico|swf|mp4|mov|mp3)$ {
    expires off;
    fastcgi_read_timeout 1000;
    log_not_found off;
    try_files $uri $uri/ @production;
    }
    location @production {
    resolver 8.8.8.8;
    proxy_pass http://domain.com/$uri;
    proxy_intercept_errors on;
    recursive_error_pages on;
    error_page 404 = @staging;
    }
    location @staging{
    resolver 8.8.8.8;
    proxy_pass http://staging.domain.com/$uri;
    proxy_intercept_errors on;
    recursive_error_pages on;
    error_page 404 = @develop;
    }

    location @develop{
    resolver 8.8.8.8;
    proxy_pass http://develop.domain.com/$uri;
    proxy_intercept_errors on;
    recursive_error_pages on;
    #error_page 404 = // nothing to see here /
    }
    }