M
M
mystdeim2016-07-16 10:47:33
Nginx
mystdeim, 2016-07-16 10:47:33

Is it possible to disable https on a specific address?

There is something like this config:

server {
    listen 80 default_server;
    server_name example.org;
    return 301 https://$server_name$request_uri;
}
server {
  listen 443 ssl default_server;
  ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem;
  root /home/deploy/apps/example/current/public;
  try_files $uri/index.html $uri @example;
  location @example {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://example;
  }
  keepalive_timeout 10;
}


How to allow a specific address, for example /non_https/* to connect via http?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Fixid, 2016-07-16
@mystdeim

add location example to the first server section and set it to /non_https/

T
TyzhSysAdmin, 2016-07-16
@POS_troi

server {
    listen 80 default_server;
    server_name example.org;
    return 301 https://$server_name$request_uri;
}
server {
  listen 443 ssl default_server;
  ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem;
  root /home/deploy/apps/example/current/public;
  try_files $uri/index.html $uri @example;
  location @example {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://example;
  }
  keepalive_timeout 10;
}

server {
    listen 80 ;
    server_name example_no_ssl.org;
    location / {
      ......
    }
.....
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question