-
-
Save mtlynch/b38a6a423b69e223c46196458eeb0d18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name tinypilot; | |
root /opt/tinypilot; | |
index index.html; | |
proxy_buffers 16 16k; | |
proxy_buffer_size 16k; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_http_version 1.1; | |
location /socket.io { | |
proxy_pass http://tinypilot; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "Upgrade"; | |
} | |
location /state { | |
auth_request /auth; | |
auth_request_set $auth_status $upstream_status; | |
proxy_pass http://ustreamer; | |
} | |
location /stream { | |
auth_request /auth; | |
auth_request_set $auth_status $upstream_status; | |
proxy_pass http://ustreamer; | |
} | |
location /snapshot { | |
auth_request /auth; | |
auth_request_set $auth_status $upstream_status; | |
proxy_pass http://ustreamer; | |
} | |
location / { | |
proxy_pass http://tinypilot; | |
} | |
location ~* ^/.+\.(html|js|js.map|css)$ { | |
root "/opt/tinypilot/app/static"; | |
# Disable caching | |
add_header Last-Modified $date_gmt; | |
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; | |
if_modified_since off; | |
expires off; | |
etag off; | |
} | |
location ~* ^/.+\.(jpg|jpeg|png|ico)$ { | |
root "/opt/tinypilot/app/static"; | |
} | |
# Authenticate any protected routes that are outside of the core | |
# TinyPilot web app. | |
location = /auth { | |
internal; | |
proxy_pass http://tinypilot/api/auth; | |
proxy_pass_request_body off; | |
proxy_set_header Content-Length ""; | |
proxy_set_header X-Original-URI $request_uri; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment