
我正在對我的 laravel 應用程式進行 docker 化,當它加載時,我收到一條錯誤訊息,指出無法提供混合內容。我查看了 html 頁面的源代碼,它確實從 http 方案加載了 app.js 文件,儘管我使用的是 https。當我在自己的 nginx 伺服器上安裝相同的 laravel 應用程式並重新導向到 https 時,app.js 將使用 https 呈現。所以這與 laravel 無關。如何使 Docker 內的 nginx conf 提供 https 內容?我目前的 .conf 檔案是這樣的:
server {
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html/public;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
gzip_static on;
}
}