I have a VPS Linux (Ubuntu) server with specific IP and I would like to run my app on my own domain http://my_domain.com. I have built a docker container and it works well on localhost 0.0.0.0:80. 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 https://cran.r-project.org/web/packages/ReviewR/vignettes/deploy_server.html#configuring-nginx-to-reverse-proxy-shiny-server , i.e.
$ sudo nano /etc/nginx/sites-available/shiny
server {
server_name my_domain.com;
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 http://my_domain.com, 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.