server{                                                                      
        listen 80;                                                           
        server_name api.arame2.shop www.api.arame2.shop;                     
                                                                             
        location /{                                                          
                return 301 https://api.arame2.shop$request_uri;              
        }                                                                    
}                                                                            
                                                                             
                                                                             
server{                                                                      
        listen 80;                                                           
        server_name arame2.shop www.arame2.shop;                             
        access_log /var/log/nginx/http.access.log;                           
        error_log /var/log/nginx/http.error.log;                             
                                                                             
        location /{                                                          
                return 301 https://arame2.shop$request_uri;                  
        }                                                                    
                                                                             
        location ^~ /.well-known/ {                                          
                allow all;                                                   
        }                                                                    
}                                                                            
                                                                             
server{                                                                      
        listen 443;                                                          
        ssl on;                                                              
        ssl_certificate /etc/letsencrypt/live/arame2.shop/fullchain.pem;     
        ssl_certificate_key /etc/letsencrypt/live/arame2.shop/privkey.pem;   
                                                                             
        ssl_dhparam /etc/letsencrypt/live/arame2.shop/dhparam.pem;           
        ssl_trusted_certificate /etc/letsencrypt/live/arame2.shop/chain.pem; 
        access_log /var/log/nginx/https.access.log;                          
        error_log /var/log/nginx/https.error.log;                            
        server_name arame2.shop www.arame2.shop;                             
        location / {                                                         
                root /studycombined/client/client/build;                     
                index index.html index.htm;                                  
                try_files $uri /index.html;                                  
        }                                                                    
        location ^~ /.well-known/ {                                          
                allow all;                                                   
        }                                                                    
}

server{
        listen 443;
        server_name api.arame2.shop www.api.arame2.shop;

        ssl on;
        ssl_certificate /etc/letsencrypt/live/api.arame2.shop/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/api.arame2.shop/privkey.pem;

        access_log /var/log/nginx/gateway.access.log;
        error_log /var/log/nginx/gateway.error.log;

        location / {
                proxy_pass <https://127.0.0.1:8000>;
        }
        location ^~ /.well-known/{
        allow all;
        }
}