Running docker app on my own domain

in flag

I have a VPS Linux (Ubuntu) server with specific IP and I would like to run my app on my own domain I have built a docker container and it works well on localhost Then, I guess I have to configure nginx to connect my domain to the server IP.

I have configured nginx in a similar way like How can I forward requests from my web server? , but using , i.e.

$ sudo nano /etc/nginx/sites-available/shiny

server {


        location / {
                proxy_pass http://localhost:80;
                proxy_redirect / $scheme://$http_host/;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection $connection_upgrade;
                proxy_read_timeout 20d;
                proxy_buffering off;

However, I have got the following:

$ sudo systemctl reload nginx

nginx.service is not active, cannot reload

Then, I have written:

$ sudo service nginx start
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.

Additionally, I have written:

$ systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2022-05-15 18:53:40 CEST; 11s ago

Finally, I have written:

$ sudo nginx -t
nginx: [emerg] unknown "connection_upgrade" variable
nginx: configuration file /etc/nginx/nginx.conf test failed

However, if I navigate to my_server_ip, I can see my app running. If I navigate to, I can see the hosting provider default page, I cannot see my app running.

I would like to know how to run my app on my own domain.

vidarlo avatar
ar flag
Broadly speaking you don't *run* an docker container on a domain. It listens to an IP address. DNS may point to IP addresses.
in flag
Does this answer your question? [How can I forward requests from my web server?](
cn flag

Add the following section to your nginx configuration:

map $http_upgrade $connection_upgrade {  
    default upgrade;
    ''      close;
Citizen avatar
in flag
I have added the section after location / { ... } how I described above, in /etc/nginx/sites-available/shiny, and it does not work. Then, I have added your section after the mail section in /etc/nginx/nginx.conf, but it does not work.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.