I use HTTPS and only want an HTTP URL with Nginx

Asked

Viewed 205 times

0

I have a site configured on an Nginx server to force HTTPS to the entire site, but I need only one URL to be in HTTP only keeping the rest of the site in HTTPS.

The URL is exactly this:

https://site.meudominio.com.br/index.php?route=primeiro/segundo/terceira/funcao

I want her to be forced to stay at HTTP only kind of like this and keep:

http://site.meudominio.com.br/index.php?route=primeiro/segundo/terceira/funcao

My configuration file looks like this:

server {

    listen      80;
    listen [::]:80;
    server_name site.meudominio.com.br;
    return 301 https://site.meudominio.com.br$request_uri;
}

server {
    listen      443 ssl http2;
    listen [::]:443 ssl http2;
    server_name site.meudominio.com.br;

    ssl on;
    ssl_certificate     /etc/ssl/fullchain.pem;
    ssl_certificate_key /etc/ssl/privkey.pem;

    include snippets/ssl-params.conf;

    root /var/www/meudominio.com.br/site;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
         try_files $uri @meudominio;
    }

    location @meudominio {
      rewrite ^/(.+)$ /index.php?_route_=$1 last;
    }

location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    }

    location ~ /\.ht {
        deny all;
    }
}
  • You said "a URL", which URL exactly, or refers to an HTTP domain and the other HTTPS?

  • Only a URL in the same domain, the url is described there in the question, I count on your help ;)!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.