node.js
node.js
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?
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?
-
- Support team
- Posts: 1111
- Joined: Tue Jul 30, 2013 10:18 pm
- Contact:
- Os: CentOS 6x
- Web: nginx + php-fpm
Re: node.js
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
hi thanks for the answer.grayfolk wrote: ↑Sat Apr 25, 2020 8:43 pmYou 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*; }
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?
-
- Support team
- Posts: 1111
- Joined: Tue Jul 30, 2013 10:18 pm
- Contact:
- Os: CentOS 6x
- Web: nginx + php-fpm
Re: node.js
Again: You should create your own nginx template for nodejs.
So, you can specify any port.
Re: node.js
I added the node.tpl but is not showing on the vestacp. What am I missing?
Re: node.js
Make sure you create your own nginx template for nodejs and add it in the right folder.