Skip to content

Instantly share code, notes, and snippets.

@gleox
Last active May 8, 2021 07:55
Show Gist options
  • Select an option

  • Save gleox/1c7dfbfc5511bfbc737eddaa985c58dc to your computer and use it in GitHub Desktop.

Select an option

Save gleox/1c7dfbfc5511bfbc737eddaa985c58dc to your computer and use it in GitHub Desktop.

Revisions

  1. gleox renamed this gist May 8, 2021. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions examples.com.conf → example.com.conf
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,11 @@
    server {
    server_name examples.com;
    server_name example.com;
    listen 443 ssl;

    ssl_certificate /opt/lego/certificates/examples.com.crt;
    ssl_certificate_key /opt/lego/certificates/examples.com.key;
    ssl_certificate /opt/lego/certificates/example.com.crt;
    ssl_certificate_key /opt/lego/certificates/example.com.key;

    access_log /var/log/nginx/sites/examples.com.log;
    access_log /var/log/nginx/sites/example.com.log;

    location / {
    root /var/www/app1;
  2. gleox renamed this gist May 8, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. gleox created this gist May 8, 2021.
    36 changes: 36 additions & 0 deletions example.com.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    server {
    server_name examples.com;
    listen 443 ssl;

    ssl_certificate /opt/lego/certificates/examples.com.crt;
    ssl_certificate_key /opt/lego/certificates/examples.com.key;

    access_log /var/log/nginx/sites/examples.com.log;

    location / {
    root /var/www/app1;
    try_files $uri $uri/ /index.html;
    }

    location /app2 {
    access_log off;
    return 302 https://$host$request_uri/;
    }

    location /app2/ {
    root /var/www/app2;
    try_files $uri $uri/ /index.html;
    }

    location ~ ^/(api|avatar|file|swagger) {
    proxy_http_version 1.1;
    proxy_cache off;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_set_header X-Forwarded-For $http_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_pass http://backend;
    }
    }