Search code examples
wordpresscurlproxmox

How to configure https VM on Proxmox to avoid cURL error 7 port 443: Connection refused?


I have a website running on a VM on Proxmox.

Public IP -> Host Proxmox -> Private IP of the VM

https -> Certificate SSL given by the Host Proxmox -> http on the private IP of the VM

On the client side (from outside) all is ok.

On the server side (admin of Wordpress), I get some cURL error 7 :

Failed to connect to mysitename.com port 443 : Connection refused

I think on the server side, wordpress admin tries to reach https://mysitename.com from the VM .... which run under http

My etc/host files (on the VM) is :

127.0.0.1       localhost mysitename.com
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
# --- BEGIN PVE ---
10.10.2.30 mysitename.com mysitename
# --- END PVE ---

What should I change in my configuration to autorize https connection from and to the local VM (which did not have the https certificate) ?

Thanks a lot !


Solution

  • I finally find how to proceed :

    On the VM, where Wordpress is running, I added on the wp-config.php file :

    if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';
    

    Then Wordpress, is able to connect to itself from the VM