Skip to content

Instantly share code, notes, and snippets.

@q0rban
Last active December 20, 2015 13:59
Show Gist options
  • Save q0rban/6142452 to your computer and use it in GitHub Desktop.
Save q0rban/6142452 to your computer and use it in GitHub Desktop.
Nginx Pull Requests config
server {
listen 0.0.0.0:80;
# Sniffs for domains of the format
# pr.[project-id].[pull-request-id].example.com, e.g.
# pr.lullabot_com.387.example.com. The project id must be only alphanumeric
# and underscores or hyphens.
server_name ~^pr\.(?<project>[a-zA-Z_-]*)\.(?<pull_request_id>[0-9]*)\.example\.com$;
## Access and error logs.
access_log /var/log/nginx/pr.$project.access.log;
error_log /var/log/nginx/pr.$project.error.log debug;
# If the directory doesn't exist, just redirect to example.com
if (!-d /var/www/pull-requests/$project/$pull_request_id) {
rewrite . http://example.com/ redirect;
}
root /var/www/pull-requests/$project/$pull_request_id;
set $php_upstream phpfpm;
# Disable the fastcgi cache.
set $logged_in 1;
include drupal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment