This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
ansible-role-warehost/warehost-api/templates/nginx.conf

37 lines
1.3 KiB
Nginx Configuration File

upstream warehostv2_api {
server {{warehost_api_internal_ip}}:{{warehost_api_internal_port}};
}
server {
listen 80;
listen [::]:80;
server_name {{warehost_api_domain}} www.{{warehost_api_domain}};
root /dev/null;
location / {
return 301 https://$server_name$request_uri;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
client_max_body_size 4G;
server_name {{warehost_api_domain}} www.{{warehost_api_domain}};
server_tokens off;
ssl_certificate_key /etc/letsencrypt/live/{{warehost_api_domain}}/privkey.pem;
ssl_certificate /etc/letsencrypt/live/{{warehost_api_domain}}/fullchain.pem;
keepalive_timeout 5;
location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://warehostv2_api;
}
location /.well-known/acme-challenge {
root /srv/http/default;
}
}