-2

I have a site in a Nginx server forces HTTPS for all site, but i need only an URL in HTTP.

This is the URL:

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

I want it to be forced to stay in HTTP just like this and hold:

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

My config file is:

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;
    }
}
  • 1
    What have you actually tried? what's not working as expected? This looks more like a "do it for me" instead of a question, please clarify what the actual issue is. – Ginnungagap Nov 29 '16 at 02:35

1 Answers1

2

The return 301 in your http section is the problem. It is telling Nginx to send everyone who comes in via http to the https URL.

Manish
  • 21
  • 2