0

i am running nginx(nginx/1.10.0) as my webserver behind AWS ELB with drupal 7 and using php7.1 issue is http://url works fine but same site with https://url serves only https components of the page and not the non https components like css etc.

and ssl termination is happening on AWS ELB side

this is my nginx configuration

server {
  listen 80 default_server;
  listen [::]:80 default_server;
  listen 443 ssl http2 default_server;
  listen [::]:443 ssl http2 default_server;

  server_name site_url;


  root /var/www/html/smb;
  index index.php index.html index.htm ;


  error_page 404 = @smb;

  location @smb {
     rewrite ^(.*)$ /index.php?q=$1 last;


  }

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

  location ~ /\.ht {
    deny all;
  }
}
HBruijn
  • 72,524
  • 21
  • 127
  • 192
  • 4
    *"the site with `https://url` serves only https components of the page and not the non https components like css"* - The solution is primarily to fix your code/html to prevent what is called **Mixed Content** (where your secure site loads insecure content) for instance by using relative URL's rather than absolute URL's to link to your stylesheets, because modern webbrowsers are like to complain about that if they don't outright block such insecure content... – HBruijn May 23 '17 at 13:03

1 Answers1

3

If ssl termination is happening on AWS ELB side, why you still using port 443? It's not needed, you could use only port 80 to handle all requests, because you don't need any SSL.

And as @HBruijn said, you have problem with your application, not nginx. Looks like there is hardcoded URLs with http:// for css etc. You should check your code and fix it.

Alexander Tolkachev
  • 4,513
  • 3
  • 14
  • 23