nginx conf 文件错误导致混合内容

nginx conf 文件错误导致混合内容

你好,有人可以帮忙检查一下 nginx conf 文件吗?

上传到我的网站的新旧图片导致混合内容错误。因此,如果我更改源代码,也无法解决问题。我认为这是由 nginx conf 文件请求引起的。图片在 https 上可用,并且 SSL 证书工作正常

示例错误:混合内容:页面位于'https://la-par.com/“已通过 HTTPS 加载,但请求了不安全的图像”http://la-par.com/content/images/thumbs/5e2d83aeaac992042f5965a4.png'。此内容也应通过 HTTPS 提供。

等/nginx/nginx.conf

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    /* Handle HTTPS Protocol */

    if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')

        $_SERVER['HTTPS']='on';

    #gzip  on;

/etc/nginx/conf.d/默认.conf

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
    server_name la-par.com www.la-par.com;


    # Added this to prevent man in the middle attacks
    add_header Strict-Transport-Security "max-age=31536000"; 

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root /var/www/la-par.com/html;
        index index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

非常感谢

答案1

如果您的网站在使用 Apache 时在 SSL 中正常运行(没有混合内容错误),则上述配置也应该可以正常工作。

相关内容