Question

Setup nginx conf 443ssl not loading the good website

hello guys I got two website on one ubuntu server I have two conf files in nginx : website1.conf website2.conf

website1 works website2 works partially only http works but not https

Setup nginx conf 443ssl not loading the good website. if you can help me

server {
    listen 80;
    server_name manonbarre.fr www.manonbarre.fr;
    root /site/manonbarre;
    index index.php index.html index.htm;
}




server {
    listen *:443 ssl;

    ssl on;
    # Use certificate and key provided by Let's Encrypt:
    ssl_certificate /etc/letsencrypt/live/manonbarre.fr/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/manonbarre.fr/privkey.pem;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';



location / {
    #resolve using Google's DNS server to force DNS resolution and prevent caching of IPs
    resolver 8.8.8.8;

    # Proxy_pass configuration
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_max_temp_file_size 0;
    proxy_pass http://0.0.0.0:2300;
    proxy_redirect off;
    proxy_read_timeout 240s;
proxy_hide_header 'Cache-Control';
add_header Cache-Control no-cache;
expires 1d;
                                

    }

    
        location /phpmyadmin {
        root /usr/share/;
        index index.php index.html index.htm;
        
        location ~ ^/phpmyadmin/(.+\.php)$ {
            try_files $uri =404;
            root /usr/share/;
            fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi_params;
        }

        location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
            root /usr/share/;
        }
    }

    location /phpMyAdmin {
        rewrite ^/* /phpmyadmin last;
    }
}

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
July 5, 2022

Hi there,

As far as I can see, there is no server_name directive in the 443 server block.

You need to define the server_name to match your domain name in both server blocks in order for Nginx to be able to differentiate which website is being loaded.

For more information on how Nginx server blocks work, I could suggest the following tutorial:

https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04

Hope that this helps!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up