Project

General

Profile

Wiki » History » Version 1

Gareth Eaton, 03/07/2023 05:57 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
The the fix is in wp-config.php add the following,
8
9
<pre>
10
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
11
  $_SERVER['HTTPS'] = 'on';
12
} 
13
</pre>
14
15
And in the NGINX config Add,
16
17
<pre>
18
server {
19
    listen 443;
20
    server_name blog.ldev.app;
21
    ssl on;     ssl_certificate /etc/pve/local/nginx/ldev-ssl.pem;
22
    ssl_certificate_key /etc/pve/local/nginx/ldev-ssl.key;
23
    proxy_redirect off;
24
    location / {
25
        proxy_set_header        Host $host:$server_port;
26
        proxy_set_header        X-Real-IP $remote_addr;
27
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
28
        proxy_set_header        X-Forwarded-Proto $scheme;
29
        proxy_pass http://*YOUR IP AND PORT*;
30
    }
31
}
32
</pre>
33
34
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 
35
<pre>
36
proxy_set_header        Host $host:$server_port;
37
proxy_set_header        X-Real-IP $remote_addr;
38
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
39
proxy_set_header        X-Forwarded-Proto $scheme; 
40
</pre>