J
J
Jekson2018-09-22 11:42:47
Nginx
Jekson, 2018-09-22 11:42:47

How to temporarily disable redirect from http to https in nginx?

The configuration file is set to http --> https redirect. Tell me what needs to be changed in the file so that the site is accessible both via http and https at the same time.

server {
    listen 80;
    listen [::]:80;
    server_name first.com www.first.com;
    return 301 https://first.com$request_uri;
}

server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        server_name www.first.com;
        include snippets/ssl-first.com.conf;
        include snippets/ssl-params.conf;
        return 301 https://first.com$request_uri;
}

server {
        # SSL configuration

        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        include snippets/ssl-first.com.conf;
        include snippets/ssl-params.conf;

        root /var/www/html;

        server_name first.com;

        location = /favicon.ico { access_log off; log_not_found off; }
        location /static/ {
            root /home/gk/first;
        }

        location / {
            include         uwsgi_params;
            uwsgi_pass      unix:/run/uwsgi/first.sock;
        }

        location ~ /.well-known {
            allow all;
            root /var/www/html;
        }

        location ~ /\.ht {
            deny all;
        }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2018-09-22
@ky0

Instead return 301 https://first.com$request_uri, add request processing similar to the second HTTPS block.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question