안녕하세요, 누군가 nginx conf 파일을 확인하는 데 도움을 줄 수 있나요?
내 사이트에 이전 이미지와 새 이미지를 업로드하면 혼합 콘텐츠 오류가 발생합니다. 따라서 소스 코드를 변경하면 문제가 해결되지 않습니다. nginx conf file -request 때문에 발생한 것 같습니다. 이미지는 https에서 사용할 수 있고 SSL 인증서는 잘 작동합니다.
예시 오류: 혼합 콘텐츠: ' 페이지https://la-par.com/'는 HTTPS를 통해 로드되었지만 안전하지 않은 이미지를 요청했습니다'http://la-par.com/content/images/thumbs/5e2d83aeaac992042f5965a4.png'. 이 콘텐츠는 HTTPS를 통해서도 제공되어야 합니다.
etc/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/default.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에서 올바르게(혼합 콘텐츠 오류 없이) 작동했다면 위 구성도 작동해야 합니다.