Answers for "nginx redirect http to https cloudflare"

0

nginx redirect http to https cloudflare

server {
  listen 80 default_server;
  listen [::]:80 default_server;
  server_name mydomain.com www.mydomain.com;

  if ($http_x_forwarded_proto = "http") {
      return 301 https://$server_name$request_uri;
  }

  root /var/www/html;

  index index.php index.html index.htm index.nginx-debian.html;

  location / {
     try_files $uri $uri/ =404;
  }

  location ~ \.php$ {
     include snippets/fastcgi-php.conf;
     fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  }

  location ~ /\.ht {
     deny all;
  }
}
Posted by: Guest on May-28-2021

Code answers related to "nginx redirect http to https cloudflare"

Browse Popular Code Answers by Language