Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Nginx Fails When Port Field is Empty, Default Port Not Set #2

Open
ludndev opened this issue Apr 20, 2024 · 0 comments
Open

Bug: Nginx Fails When Port Field is Empty, Default Port Not Set #2

ludndev opened this issue Apr 20, 2024 · 0 comments

Comments

@ludndev
Copy link

ludndev commented Apr 20, 2024

Description

When the port field is left empty in the configuration, Nginx fails to start due to an invalid port in the upstream configuration. This issue occurs because the default port (3000) is not automatically set when the port field is empty. The error message received when running nginx -t is as follows:

nginx: [emerg] invalid port in upstream "127.0.0.1:" in /home/user/hestiacp_nodejs_config/web/domain.tld/nodejs-app.conf:2

This indicates that Nginx is unable to parse the configuration due to the missing port number after the IP address.

Steps to Reproduce

  1. Configure the Nginx upstream to use an IP address without specifying a port.
  2. Attempt to start Nginx with the configuration.
  3. Observe the error message indicating an invalid port in the upstream configuration.

Generated config files

# .conf
PORT=|START_SCRIPT=""|NODE_VERSION=v20.10.0
# nodejs-app-fallback.conf
location @fallback {
	proxy_pass http://127.0.0.1::/$1;
}
# nodejs-app.conf
location / {
	proxy_pass http://127.0.0.1:;
   	proxy_http_version 1.1;
 	proxy_set_header Upgrade $http_upgrade;
 	proxy_set_header Connection 'upgrade';
 	proxy_set_header Host $host;
	proxy_cache_bypass $http_upgrade;
}

Expected Behavior

It should automatically use the default port (3000) when the port field is empty in the configuration. This would allow Nginx to start successfully without requiring a port to be explicitly specified.

Environment

  • HestiaCP version: 1.8.11
  • Nginx version: 1.25.5
  • Operating System: ubuntu 22.04
  • Configuration File: /home/user/hestiacp_nodejs_config/web/domain.tld/nodejs-app.conf
ludndev added a commit to ludndev/hestiacp-nodejs that referenced this issue Apr 20, 2024
ludndev added a commit to ludndev/hestiacp-nodejs that referenced this issue Apr 20, 2024
Fix issue JLFdzDev#2 : Nginx Fails When Port Field is Empty, Default Port Not Set JLFdzDev#3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant