I have a VPS Linux (Ubuntu) server and I would like to connect a domain name with my server IP through nginx, but nginx does not work. I have checked the following:

$ sudo systemctl reload nginx

nginx.service is not active, cannot reload

$ 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.

$ 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

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

In relation to run an app on my own domain, I have a nginx configuration file:

$ sudo cat /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;


I would appreciate if someone could help me with this issue.

  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    May 17 at 20:53
  • its a problem with your nginx config file, as the logs says there is a unkown variable connection_upgrade used there.
    – benyamin
    May 18 at 14:36
  • Welcome. You should take a look at How to Ask and take the tour, if you have not done so already. Also take a look at [example].
    – cliff2310
    May 18 at 16:43

1 Answer 1


just replace proxy_set_header Upgrade $http_upgrade; in /etc/nginx/sites-available/shiny with this :

proxy_set_header Connection "upgrade";

and then run nginx -t to test the configuration file, the output should be like this if everything was alright :

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

then run nginx -s reload so the nginx will update the configurations on the fly.

and don't forget to delete that proxy_redirect / $scheme://$http_host/; and add a listen 4444 at the end of server block to specify the listen port.

  • Thanks. I have tried your solution, but in my case it does not work.
    – Citizen
    May 18 at 20:02
  • you should delete proxy_set_header Upgrade $http_upgrade; and keep proxy_set_header Connection "upgrade";
    – benyamin
    May 19 at 8:24

Your Answer

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.