0

I have a VM running ngnix with magento 2 . internally , my vm is resolved by : marketplace.corp.mycloud.com

From the internet, it is resolved with : marketplace.mycloud.com

Http is working fine so far. and I want to keep the 2 options for demo purposes and later for inspections..

However, HTTPS is not working and I have been puzzled by all comments..

So here is the content of my nginx file of My Magento VM :

    upstream fastcgi_backend {
    server   unix:/run/php/php7.2-fpm.sock;
    }

    server {
            server_name marketplace.corph.mouradcloud.com;
            index  index.php index.html index.htm;
            listen 80;
            client_max_body_size 100M;
            set $MAGE_ROOT /var/www/marketplace.corph.mouradcloud.com/;
            set $MAGE_MODE developer;
            access_log /var/log/nginx/marketplace.corph.mouradcloud.com-access.log;
            error_log /var/log/nginx/marketplace.corph.mouradcloud.com-error.log;
            include /var/www/marketplace.corph.mouradcloud.com/nginx.conf.sample;
            }

Now here is the content of my reverse proxy nginx configuration :

        upstream marketplaceserver {
            server marketplace.corph.mouradcloud.com;
        }

        server {
        listen 80;
        listen 443;
        server_name marketplace.mouradcloud.com;
        ssl_certificate /XXXX/XXXX/XXXX/marketplace.mouradcloud.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /XXXX/XXXX/XXXX/marketplace.mouradcloud.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

                location / {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto https;
                proxy_set_header X-Forwarded-Port 443;
                proxy_set_header Host $host;
                proxy_pass http://marketplaceserver;
                }


        }

The target is this one :

enter image description here

I have been switching configurations but I was not able to get it work, ideally, I would like to keep all configuration to the frontend proxy and not touch the magento configurations..

Any clue ?

New contributor
MouIdri is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

As always... I should have been waiting and continue testing the differents parameters. SO here is the solution WITHOUT TOUCHING THE NGINX CONFIGURATION on the Magento VM but adapting the proxy. the configuration of the nginx vm proxy if this :

    server {
        listen 80;
    listen 443;
        server_name marketplace.mouradcloud.com;
    ssl on;
    ssl_certificate /etc/letsencrypt/live/marketplace.mouradcloud.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/marketplace.mouradcloud.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

        location / {
            proxy_pass http://marketplace.corph.mouradcloud.com;
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;


        }
    }
New contributor
MouIdri is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

MouIdri is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.