0

SSL 証明書を使用したサーバーのセットアップで問題が発生しています。証明書を問題なくインストールでき、nginx サービスを再起動しました。しかし、Web サイトを読み込もうとすると、すべての img、css、および js ファイルが https ではなく http で取得されていることがわかります。これはマジェントのウェブサイトです。conf ファイルに何か問題がありますか?

server {
    listen 80;
    server_name www.my-domain.com;
    return 301 $scheme://my-domain.com$request_uri;
}

server {
    listen 80;
    listen 443 ssl;

    ssl_certificate     /etc/ssl/my-domain/my-domain_com.pem;
    ssl_certificate_key /etc/ssl/my-domain/my-domain_com.key;

    access_log /var/log/nginx/magento.local-access.log;
    error_log  /var/log/nginx/magento.local-error.log;

    server_name my-domain.com;
    root /var/www/my-domain;

    include conf/magento_rewrites.conf;
    include conf/magento_security.conf;

    # PHP handler
    location ~ \.php {
      ## Catch 404s that try_files miss
      if (!-e $request_filename) { rewrite / /index.php last; }

      ## Store code is defined in administration > Configuration > Manage Stores
      fastcgi_param MAGE_RUN_CODE default;
      fastcgi_param MAGE_RUN_TYPE store;

      # By default, only handle fcgi without caching
      include conf/magento_fcgi.conf;
    }

    # 404s are handled by front controller
    location @magefc {
      rewrite / /index.php;
    }

    # Last path match hands to magento or sets global cache-control
    location / {
      ## Maintenance page overrides front controller
      index index.html index.php;
      try_files $uri $uri/ @magefc;
      expires 24h;
    }

    rewrite ^/minify/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last;
    rewrite ^/skin/m/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last;

    location /lib/minify/ {
        allow all;
    }

}
4

1 に答える 1

0

おそらくこれが彼らの呼び方です。すべてをhttpsとして提供する必要がある場合は、リッスンし80てhttpsにリダイレクトする空のサーバーを作成します

server {
    # listen 80; delete this part
    listen 443 ssl;
    # the rest of the config
}
# add this server
server {
    listen 80;
    server_name example.com;
    location / # or a more specific location '~ \.(jpg|css|js|jpeg|png|gif)' {
        return https://example.com$request_uri;
    }
}

またはCSSの場所を修正するだけで、httpを含む絶対URLである可能性があります

于 2013-07-20T13:15:12.087 に答える