Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

[GUIDE]EASY use Nodejs on VESTAcp Ubuntu

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
11 posts
  • 1
  • 2
  • Next
robert.ne13
Posts: 15
Joined: Sat May 05, 2018 12:15 pm

Os: Ubuntu 15x
Web: apache + nginx
[GUIDE]EASY use Nodejs on VESTAcp Ubuntu
  • Quote

Post by robert.ne13 » Sat May 05, 2018 5:36 pm

first we need to install
aptitude
on console

Code: Select all

sudo apt install aptitude
and put

Code: Select all

aptitude install -y libapache2-mod-proxy-html libxml2-dev
later configure

Code: Select all

sudo a2enmod
and we add the new mods

Code: Select all

proxy proxy_ajp proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_html
ok now apache is ready to redirect any port from vesta panel to port of nodejs express
Now we have to create a new hosting account
and configure to redirect to nodejs port
open the file

Code: Select all

nano /home/[put user]/conf/web/[web to redirect nodejs ]apache2.httpd.conf
and add this lines:
Behind

Code: Select all

<VirtualHost YOUR.IP:PORT>
ADD

Code: Select all

    ProxyPreserveHost On
    ProxyRequests Off
    ProxyVia Full
and before the end of document

Code: Select all

</VirtualHost>
ADD this:

Code: Select all

<Location /> 
        ProxyPassReverse http://127.0.0.1:3000/
        ProxyPass http://127.0.0.1:3000/ connectiontimeout=5 timeout=30
        </Location>
        
NOTE: my port of nodejs is 3000 modify as yours and if you want to use a folder to redirect to nodejs put this

Code: Select all

<Location /nodejs>
        ProxyPassReverse http://127.0.0.1:3000/
        ProxyPass http://127.0.0.1:3000/ connectiontimeout=5 timeout=30
        </Location>
now the domain of nodejs will be
http://localhost/nodejs/ -> will send you to http://localhost:3000

REMIND to open port on firewall of nodejs
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: [GUIDE]EASY use Nodejs on VESTAcp Ubuntu
  • Quote

Post by mehargags » Sun May 06, 2018 6:00 am

Good guide...
However, Vesta uses Nginx as reverse proxy so wouldn't it be better to configure Nginx to be proxy for your NodeJS straight and not do Nginx > Apache > NodeJS ??
Top

ScIT
Support team
Posts: 617
Joined: Mon Feb 23, 2015 4:13 pm

Os: Ubuntu 17x
Web: apache + nginx
Re: [GUIDE]EASY use Nodejs on VESTAcp Ubuntu
  • Quote

Post by ScIT » Sun May 06, 2018 6:51 am

also do not change the conf files in user directory, they get overwritten after a change (for example adding a alias and so on). It is better, to create a nodejs template in /usr/local/vesta/data/templates/web/nginx/, just copy the default template you want to have and do the modification there.
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: [GUIDE]EASY use Nodejs on VESTAcp Ubuntu
  • Quote

Post by mehargags » Sun May 06, 2018 2:35 pm

ScIT wrote: ↑
Sun May 06, 2018 6:51 am
It is better, to create a nodejs template in
Exactly,
That should be the right way forward. Infact, you can submit your template to the dev team and they may include it in official version too
Top

robert.ne13
Posts: 15
Joined: Sat May 05, 2018 12:15 pm

Os: Ubuntu 15x
Web: apache + nginx
Re: [GUIDE]EASY use Nodejs on VESTAcp Ubuntu
  • Quote

Post by robert.ne13 » Wed May 09, 2018 8:13 pm

i am a new user of VESTACP i like so much, so i will read some docs of how make a new template and i will make a new one to send
Top

anxieter
Posts: 10
Joined: Wed May 23, 2018 12:43 pm

Os: Ubuntu 17x
Web: apache + nginx
Re: [GUIDE]EASY use Nodejs on VESTAcp Ubuntu
  • Quote

Post by anxieter » Thu May 24, 2018 9:02 am

Hello
It is second day I'm trying to intall nodejs to my VestaCP accordingly to your instruction.
I need help.
In the begginning of tutorial you edit apache configuration in

Code: Select all

nano /home/[put user]/conf/web/[web to redirect nodejs ]apache2.httpd.conf
Then it is advised to use templates, but the root given goes to ngnix configuration

Code: Select all

/usr/local/vesta/data/templates/web/nginx/
Was it mastake? I think that root to a template should goes to

Code: Select all

/usr/local/vesta/data/templates/web/apache2/
to modify apache configuration.

If not - what changes should be made in nginx template

Code: Select all

default.tpl
Top

ScIT
Support team
Posts: 617
Joined: Mon Feb 23, 2015 4:13 pm

Os: Ubuntu 17x
Web: apache + nginx
Re: [GUIDE]EASY use Nodejs on VESTAcp Ubuntu
  • Quote

Post by ScIT » Thu May 24, 2018 9:03 am

This was a mistake yes, please use the apache folder.
Top

anxieter
Posts: 10
Joined: Wed May 23, 2018 12:43 pm

Os: Ubuntu 17x
Web: apache + nginx
Re: [GUIDE]EASY use Nodejs on VESTAcp Ubuntu
  • Quote

Post by anxieter » Thu May 24, 2018 12:55 pm

Can you check if I modified template without errors?

Code: Select all

cd /usr/local/vesta/data/templates/web/apache2# 

Code: Select all

nano default.tpl
http://joxi.ru/8Ana0YktqYY8j2

After editing this I typed

Code: Select all

for user in $(ls /usr/local/vesta/data/users/);do v-rebuild-user $user;done
When I go to site - this configuration makes Service Unavailable error
Maybe I had to point out http://my.external.ip:3000/ ??
Top

ScIT
Support team
Posts: 617
Joined: Mon Feb 23, 2015 4:13 pm

Os: Ubuntu 17x
Web: apache + nginx
Re: [GUIDE]EASY use Nodejs on VESTAcp Ubuntu
  • Quote

Post by ScIT » Thu May 24, 2018 5:34 pm

would like that robert.ne13 will answer here, my reply was only about the modification place and not the content itself.
Top

robert.ne13
Posts: 15
Joined: Sat May 05, 2018 12:15 pm

Os: Ubuntu 15x
Web: apache + nginx
Re: [GUIDE]EASY use Nodejs on VESTAcp Ubuntu
  • Quote

Post by robert.ne13 » Fri Jun 22, 2018 8:40 am

i recomend to you create a new template for this kind of use but instead of this it seems to be all ok you checked the port was opened and started service ?.
Top


Post Reply
  • Print view

11 posts
  • 1
  • 2
  • Next

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password