Skip to content

Instantly share code, notes, and snippets.

@farmdawgnation
Created September 24, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farmdawgnation/d838c66816244aa64256 to your computer and use it in GitHub Desktop.
Save farmdawgnation/d838c66816244aa64256 to your computer and use it in GitHub Desktop.
Depend On Nginx Config
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/ssl/{{ dependon_hostname }}.crt;
ssl_certificate_key /etc/ssl/private/{{ dependon_hostname }}.key;
server_name {{ dependon_hostname }};
{% if auth_realm is defined %}
auth_basic "{{ auth_realm }}";
auth_basic_user_file /etc/nginx/dependon.htpasswd;
{% endif %}
add_header Strict-Transport-Security "max-age=31536000;";
location / {
proxy_pass http://127.0.0.1:8080;
}
}
server {
listen 80;
listen [::]:80;
server_name {{ dependon_hostname }};
location / {
rewrite ^/(.*)$ https://{{ dependon_hostname }}/$1;
}
}
{%if www_redirect is defined %}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name www.{{ dependon_hostname }};
ssl_certificate /etc/ssl/{{ dependon_hostname }}.crt;
ssl_certificate_key /etc/ssl/private/{{ dependon_hostname }}.key;
add_header Strict-Transport-Security "max-age=31536000;";
location / {
rewrite ^/(.*)$ https://{{ dependon_hostname }}/$1 permanent;
}
}
server {
listen 80;
listen [::]:80;
server_name www.{{ dependon_hostname }};
location / {
rewrite ^/(.*)$ https://{{ dependon_hostname }}/$1 permanent;
}
}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment