Nginx代理不通过https

时间:2018-11-26 18:30:14

标签: wordpress apache nginx nginx-reverse-proxy

我有一个Nginx通过代理Apache服务的Wordpress网站。网站显示良好,但资产是通过http而不是https提供的,这会引起一些问题。

这是我的nginx conf文件:

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name subdomain.website.com;
root /home/subdomain.website.com;

# SSL CERT here
ssl_certificate /etc/nginx/ssl/.../server.crt;
ssl_certificate_key /etc/nginx/ssl/.../server.key;

ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparams.pem;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";

index index.html index.htm index.php;

charset utf-8;

location / {
    try_files $uri $uri/ /index.php?$query_string;
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;

    proxy_set_header Host $host;

    proxy_pass http://127.0.0.1:8081;
    proxy_set_header X-Forwarded-Proto https;

}


location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt  { access_log off; log_not_found off; }

access_log off;
error_log  /var/log/nginx/subdomain.website.com-error.log error;

error_page 404 /index.php;

proxy_connect_timeout       600;
proxy_send_timeout          600;
proxy_read_timeout          600;
send_timeout                600;

location ~ /\.(?!well-known).* {
    deny all;
}

}

我不确定这些规则中对于使用https通过代理提供的http文件是否缺少哪些规则?

非常感谢!

0 个答案:

没有答案