Skip to content

Commit

Permalink
nginx: add hashbang-http
Browse files Browse the repository at this point in the history
  • Loading branch information
mayli committed Jun 28, 2018
1 parent 8f98899 commit 99350ca
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions ansible/tasks/nginx/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,33 @@
name={{ item }}
with_items:
- nginx

- name: Setup sites-enabled/hashbang-http
register: nginxconf
copy:
dest: /etc/nginx/sites-enabled/hashbang-http
content: |
# Hashbang server configuration
# ref: https://gist.github.com/RyanSquared/e59c7e274abef06e63b0e47e46997b00
#
server {
listen 80;
listen [::]:80;
server_name "~^(?<user>[a-zA-Z0-9]+)\.(?<server>\w{2}\d{1})\.hashbang\.sh$";
location / {
proxy_pass http://unix:/home/$user/.nginx.sock;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
- name: Remove default nginx site
file:
state: absent
path: /etc/nginx/sites-enabled/default

- name: Restart nginx
when: nginxconf.chnaged
service: name=nginx state=restarted enabled=yes

0 comments on commit 99350ca

Please sign in to comment.