Skip to content

Instantly share code, notes, and snippets.

@mrluanma
Created August 9, 2014 08:47
Show Gist options
  • Save mrluanma/c7a79b0f5f80c54b05d1 to your computer and use it in GitHub Desktop.
Save mrluanma/c7a79b0f5f80c54b05d1 to your computer and use it in GitHub Desktop.
upstream hurl_proxy {
server www.hurl.it;
keepalive 600;
}
server {
listen 80;
server_name hurl.example.com;
access_log /var/log/nginx/hurl_proxy.access.log;
error_log /var/log/nginx/hurl_proxy.error.log;
location / {
proxy_http_version 1.1;
proxy_set_header Host "www.hurl.it";
proxy_set_header Connection "";
proxy_redirect http://www.hurl.it/ /;
proxy_pass http://hurl_proxy;
# ngx_http_sub_module
# http://nginx.org/en/docs/http/ngx_http_sub_module.html
sub_filter "ajax.googleapis.com/ajax/libs/" "cdn.staticfile.org/";
sub_filter_last_modified on;
sub_filter_once off;
}
}
include:
- nginx
/etc/nginx/sites-available/hurl_proxy.conf:
file:
- managed
- source: salt://hurl_proxy/hurl_proxy.conf
- template: jinja
- user: root
- group: root
- mode: 644
- watch_in:
- service: nginx
/etc/nginx/sites-enabled/hurl_proxy.conf:
file.symlink:
- target: /etc/nginx/sites-available/hurl_proxy.conf
- watch_in:
- service: nginx
nginx-ppa:
pkgrepo.managed:
- ppa: nginx/stable
- require_in:
- pkg: nginx
nginx:
pkg:
- name: nginx-full
- installed
- refresh: True
service:
- running
- enable: True
- reload: True
- require:
- pkg: nginx
remove_default_site:
file:
- absent
- names:
- /etc/nginx/sites-available/default
- /etc/nginx/sites-enabled/default
- watch_in:
- service: nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment