Last active
June 21, 2018 09:59
-
-
Save anhtran/3cd7bca74553b5c55f8e5212c05898d0 to your computer and use it in GitHub Desktop.
Using YouTrack with nginx as proxy, so you can install Certbot easily (Let's Encrypt)
This file contains hidden or 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
# Run command: `java -Xmx1g -XX:MaxMetaspaceSize=250m -Djava.awt.headless=true -jar youtrack-xxxx.x.xxx.jar my.domain.com:9988` | |
upstream youtrack_upstream { | |
server my.domain.com:9988; | |
} | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
server { | |
#listen 443 ssl http2; | |
listen 80; | |
server_name my.domain.com; | |
root /home/username/webapps/youtrack; | |
index index.html index.htm; | |
recursive_error_pages on; | |
server_tokens off; | |
client_max_body_size 30M; | |
# add some caching on static assets | |
location ~* \.(jpg|jpeg|png|gif|ico|css|js|eot|woff|svg|json|wav|mp3|ogg)$ { | |
proxy_ignore_headers "Cache-Control"; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header HOST $host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
expires 10y; | |
proxy_pass http://youtrack_upstream; | |
} | |
location / { | |
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; | |
proxy_redirect off; | |
proxy_buffering off; | |
proxy_set_header X-Forwarded-Host $http_host; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_read_timeout 60s; | |
proxy_send_timeout 180s; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_pass http://youtrack_upstream; | |
} | |
location /api/eventSourceBus { | |
proxy_cache off; | |
proxy_buffering off; | |
proxy_read_timeout 86400s; | |
proxy_send_timeout 86400s; | |
proxy_set_header Connection ''; | |
chunked_transfer_encoding off; | |
proxy_set_header X-Forwarded-Host $http_host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_http_version 1.1; | |
proxy_pass http://youtrack_upstream; | |
} | |
location ~ /.well-known { | |
allow all; | |
} | |
location /robots.txt { | |
alias /home/username/webapps/youtrack/robots.txt; | |
expires 30d; | |
access_log off; | |
} | |
location ~ \.(txt) { | |
root /home/username/webapps/youtrack; | |
expires 30d; | |
access_log off; | |
} | |
location ~* \.(eot|otf|ttf|woff)$ { | |
expires 30d; | |
add_header Access-Control-Allow-Origin *; | |
access_log off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment