Project

General

Profile

Wiki » History » Version 3

Gareth Eaton, 03/07/2023 06:09 AM

1 1 Gareth Eaton
h1. Wiki
2
3
4
If WordPress is unable to determine when requests are made over HTTPS, causing it to be incapable of serving HTTPS-specific content. 
5
Web browsers nowadays usually prohibit loading insecure content within pages that are accessed via HTTPS, which results in predictable issues.
6
7 2 Gareth Eaton
See [[SSL Insecure Content Fixer]]
8
9 3 Gareth Eaton
The the fix is in wp-config.php add the following, you must place that code BEFORE anything else, except for the beginning PHP tag.
10 1 Gareth Eaton
11
<pre>
12
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
13
  $_SERVER['HTTPS'] = 'on';
14
} 
15
</pre>
16
17
And in the NGINX config Add,
18
19
<pre>
20
server {
21
    listen 443;
22
    server_name blog.ldev.app;
23
    ssl on;     ssl_certificate /etc/pve/local/nginx/ldev-ssl.pem;
24
    ssl_certificate_key /etc/pve/local/nginx/ldev-ssl.key;
25
    proxy_redirect off;
26
    location / {
27
        proxy_set_header        Host $host:$server_port;
28
        proxy_set_header        X-Real-IP $remote_addr;
29
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
30
        proxy_set_header        X-Forwarded-Proto $scheme;
31
        proxy_pass http://*YOUR IP AND PORT*;
32
    }
33
}
34
</pre>
35
36
If your using Nginx Proxy Manager point to the root dir in Custom locations, and in the Advanced tab, use the Custom Nginx Configuration below 
37
<pre>
38
proxy_set_header        Host $host:$server_port;
39
proxy_set_header        X-Real-IP $remote_addr;
40
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
41
proxy_set_header        X-Forwarded-Proto $scheme; 
42
</pre>