Page 1 of 1

node.js

Posted: Sat Apr 25, 2020 7:57 pm
by orgolan
hi,

does someone has step by step guide to how to create a simple hello world node.js app in a server which contain vestacp.

which web template to choose?
i see there is nginx support but not as web template but as proxy support.

anyone?

Re: node.js

Posted: Sat Apr 25, 2020 8:43 pm
by grayfolk
orgolan wrote:
Sat Apr 25, 2020 7:57 pm
hi,

does someone has step by step guide to how to create a simple hello world node.js app in a server which contain vestacp.

which web template to choose?
i see there is nginx support but not as web template but as proxy support.

anyone?
You should create your own nginx template for nodejs.
Like this example:

Code: Select all

server {
    listen      %ip%:%web_ssl_port% ssl http2;
    server_name %domain_idn%;
    root        %home%/%user%/nodejsroot/public;
    access_log  /var/log/nginx/domains/%domain%.log combined;
    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
    error_log   /var/log/nginx/domains/%domain%.error.log error;

    ssl_certificate      %ssl_pem%;
    ssl_certificate_key  %ssl_key%;

    location / {
        proxy_pass http://127.0.0.1:3000;
        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;
    }
    include     %home%/%user%/conf/web/snginx.%domain%.conf*;
}

Re: node.js

Posted: Sun Apr 26, 2020 8:13 am
by orgolan
grayfolk wrote:
Sat Apr 25, 2020 8:43 pm
orgolan wrote:
Sat Apr 25, 2020 7:57 pm
hi,

does someone has step by step guide to how to create a simple hello world node.js app in a server which contain vestacp.

which web template to choose?
i see there is nginx support but not as web template but as proxy support.

anyone?
You should create your own nginx template for nodejs.
Like this example:

Code: Select all

server {
    listen      %ip%:%web_ssl_port% ssl http2;
    server_name %domain_idn%;
    root        %home%/%user%/nodejsroot/public;
    access_log  /var/log/nginx/domains/%domain%.log combined;
    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
    error_log   /var/log/nginx/domains/%domain%.error.log error;

    ssl_certificate      %ssl_pem%;
    ssl_certificate_key  %ssl_key%;

    location / {
        proxy_pass http://127.0.0.1:3000;
        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;
    }
    include     %home%/%user%/conf/web/snginx.%domain%.conf*;
}
hi thanks for the answer.
correct me if i'm wrong but this template only support port 3000?
any chance that can be configured for mulituple website using the same template?

Re: node.js

Posted: Sun Apr 26, 2020 11:10 am
by grayfolk
orgolan wrote:
Sun Apr 26, 2020 8:13 am

hi thanks for the answer.
correct me if i'm wrong but this template only support port 3000?
any chance that can be configured for mulituple website using the same template?
Again: You should create your own nginx template for nodejs.
So, you can specify any port.

Re: node.js

Posted: Sun Nov 29, 2020 4:40 am
by mylastore
I added the node.tpl but is not showing on the vestacp. What am I missing?

Re: node.js

Posted: Sun Nov 29, 2020 6:49 am
by grayfolk
mylastore wrote:
Sun Nov 29, 2020 4:40 am
I added the node.tpl but is not showing on the vestacp. What am I missing?
You was added it into wrong folder.

Re: node.js

Posted: Wed Dec 09, 2020 4:59 am
by danlevy
orgolan wrote:
Sat Apr 25, 2020 7:57 pm
hi,

does someone has step by step guide to how to create a simple hello world node.js app in a server which run 3 contain vestacp.

which web template to choose?
i see there is nginx support but not as web template but as proxy support.

anyone?
Make sure you create your own nginx template for nodejs and add it in the right folder.