Author Topic: NodeJS 503 error after app restart  (Read 2510 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
NodeJS 503 error after app restart
« on: May 20, 2022, 12:54:28 PM »
I restarted NodeJS app here:
Code: [Select]
module=mod_nodejs
Nginx service runs well. No nginx errors

But still I have 503 service unavailable error

I restarted server but no luck.

Following the directions here - https://wiki.centos-webpanel.com/webserver-errors does not help either.

Code: [Select]
==> /var/log/cwp/webservers.log <==
2022-05-20 12:05:26 domain.com Nginx: SUCCESS conf enabled
2022-05-20 12:05:26 domain.com Nginx SSL: SUCCESS conf enabled template: default/default
2022-05-20 12:05:26 domain.com Apache: SUCCESS conf enabled
2022-05-20 12:05:26 domain.com Apache SSL: SUCCESS conf enabled template: default/default
2022-05-20 12:05:01 nodejsapp.domain.com Running Nginx/Apache/Proxy
2022-05-20 12:05:01 nodejsapp.domain.com Delete all configuration for domain
2022-05-20 12:05:01 nodejsapp.domain.com Nginx: SUCCESS conf enabled
2022-05-20 12:05:01 nodejsapp.domain.com Nginx SSL: SUCCESS conf enabled template: default/default
2022-05-20 12:05:01 nodejsapp.domain.com Apache: SUCCESS conf enabled
2022-05-20 12:05:01 nodejsapp.domain.com Apache SSL: SUCCESS conf enabled template: proxy/all_methods



/etc/nginx/conf.d/vhosts/nodejsapp.domain.com.conf



Code: [Select]
server {
listen 123.456.789.101:80;
server_name nodejsapp.domain.com  www.nodejsapp.domain.com;

access_log /usr/local/apache/domlogs/nodejsapp.domain.com.bytes bytes;
access_log /usr/local/apache/domlogs/nodejsapp.domain.com.log combined;
error_log /usr/local/apache/domlogs/nodejsapp.domain.com.error.log error;

location / {
location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|woff|ttf|svg|eot|sh|webp)$ {
root /home/useraccount/public_html/nodejsapp/build;
expires max;
try_files $uri $uri/ @backend;
}

error_page 405 = @backend;
error_page 500 = @custom;
add_header X-Cache "HIT from Backend";
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
proxy_pass http://123.456.789.101:8181;
include proxy.inc;
}

location @backend {
internal;
proxy_pass http://123.456.789.101:8181;
include proxy.inc;
}

location @custom {
internal;
proxy_pass http://123.456.789.101:8181;
include proxy.inc;
}

location ~ .*\.(php|jsp|cgi|pl|py)?$ {
proxy_pass http://123.456.789.101:8181;
include proxy.inc;
}

location ~ /\.ht    {deny all;}
location ~ /\.svn/  {deny all;}
location ~ /\.git/  {deny all;}
location ~ /\.hg/   {deny all;}
location ~ /\.bzr/  {deny all;}

disable_symlinks if_not_owner from=/home/useraccount/public_html/nodejsapp/build;

location /.well-known/acme-challenge {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}

location /.well-known/pki-validation {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}
}

server {
listen 123.456.789.101:80;
server_name webmail.nodejsapp.domain.com;

access_log /usr/local/apache/domlogs/nodejsapp.domain.com.bytes bytes;
access_log /usr/local/apache/domlogs/nodejsapp.domain.com.log combined;
error_log /usr/local/apache/domlogs/nodejsapp.domain.com.error.log error;

location / {
proxy_pass  http://127.0.0.1:2095;
include proxy.inc;
}

location ~ /\.ht    {deny all;}
location ~ /\.svn/  {deny all;}
location ~ /\.git/  {deny all;}
location ~ /\.hg/   {deny all;}
location ~ /\.bzr/  {deny all;}

disable_symlinks if_not_owner from=/home/useraccount/public_html/nodejsapp/build;

location /.well-known/acme-challenge {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}

location /.well-known/pki-validation {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}
}

server {
listen 123.456.789.101:80;
server_name mail.nodejsapp.domain.com;

access_log /usr/local/apache/domlogs/nodejsapp.domain.com.bytes bytes;
access_log /usr/local/apache/domlogs/nodejsapp.domain.com.log combined;
error_log /usr/local/apache/domlogs/nodejsapp.domain.com.error.log error;

location / {
proxy_pass  http://127.0.0.1:2095;
include proxy.inc;
}

location ~ /\.ht    {deny all;}
location ~ /\.svn/  {deny all;}
location ~ /\.git/  {deny all;}
location ~ /\.hg/   {deny all;}
location ~ /\.bzr/  {deny all;}

disable_symlinks if_not_owner from=/home/useraccount/public_html/nodejsapp/build;

location /.well-known/acme-challenge {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}

location /.well-known/pki-validation {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}
}

server {
listen 123.456.789.101:80;
server_name cpanel.nodejsapp.domain.com;

access_log /usr/local/apache/domlogs/nodejsapp.domain.com.bytes bytes;
access_log /usr/local/apache/domlogs/nodejsapp.domain.com.log combined;
error_log /usr/local/apache/domlogs/nodejsapp.domain.com.error.log error;

location / {
proxy_pass  https://127.0.0.1:2083;
include proxy.inc;
}

location /pma {
proxy_pass  https://127.0.0.1:2031;
include proxy.inc;
}

location /roundcube {
proxy_pass  https://127.0.0.1:2031;
include proxy.inc;
}

location ~ /\.ht    {deny all;}
location ~ /\.svn/  {deny all;}
location ~ /\.git/  {deny all;}
location ~ /\.hg/   {deny all;}
location ~ /\.bzr/  {deny all;}

disable_symlinks if_not_owner from=/home/useraccount/public_html/nodejsapp/build;

location /.well-known/acme-challenge {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}

location /.well-known/pki-validation {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}
}

It is lisetening to port
Code: [Select]
8181 yet I configured
Code: [Select]
3333 in
Code: [Select]
module=mod_nodejs
The server running:

Code: [Select]
Nginx & Apache
Additional Options: proxy
HTTP: Nginx (80) --> Apache (8181)
HTTPS: Nginx (443) --> Apache (8181)
Nginx: 80,443
Apache: 8181,8443

Webserver conf for nodejsapp.domain.com:
Code: [Select]
nginx -> apache -> proxy (3333)

CWP Version: CWPpro version: 0.9.8.1138
« Last Edit: May 20, 2022, 01:21:09 PM by josephgodwinke »
Applications Developer | RHEL Linux Server Administrator

Reach out to me in pm to solve any application deployment such as NodeJS, Java, PHP etc


Managed 40gb Shared CWP PRO Hosting for $20 p/a offer
Managed 60gb Shared CWP PRO Hosting for $40 p/a offer
Managed 100gb Shared CWP PRO Hosting for $60 p/a offer
Managed 200gb Shared CWP PRO Hosting for $120 p/a offer


CentOS 8 died a premature death at the end of 2021 - migrate to RockyLinux Os.

Offline
*
Re: NodeJS 503 error after app restart
« Reply #1 on: May 20, 2022, 05:08:04 PM »
SOLVED: Environment variables were not set correctly for HOST and Database connection. This article https://wiki.centos-webpanel.com/webserver-errors needs an update to include these possibilities:

  • incorrect functionality of a proxy server such as nginx reverse proxy
  • lack of server resources to process all incoming requests
  • temporary overloading or maintenance of the server
Applications Developer | RHEL Linux Server Administrator

Reach out to me in pm to solve any application deployment such as NodeJS, Java, PHP etc


Managed 40gb Shared CWP PRO Hosting for $20 p/a offer
Managed 60gb Shared CWP PRO Hosting for $40 p/a offer
Managed 100gb Shared CWP PRO Hosting for $60 p/a offer
Managed 200gb Shared CWP PRO Hosting for $120 p/a offer


CentOS 8 died a premature death at the end of 2021 - migrate to RockyLinux Os.