Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ HCPP-NodeApp requires an Ubuntu or Debian based installation of [Hestia Control

```
cd /usr/local/hestia/plugins
sudo git clone --branch v2.0.3 https://github.com/virtuosoft-dev/hcpp-nodeapp nodeapp
sudo git clone https://github.com/sharklatan/hcpp-nodeapp nodeapp
```

Note: It is important that the destination plugin folder name is `nodeapp`.
Expand Down
16 changes: 14 additions & 2 deletions nodeapp.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ public function allocate_ports( $nodeapp_folder ) {
$user = $parse[2];
$domain = $parse[4];

// Ensure ports directory exists for this user
$ports_dir = "/usr/local/hestia/data/hcpp/ports/$user";
if ( ! is_dir( $ports_dir ) ) {
$hcpp->log( "allocate_ports: creating ports dir $ports_dir" );
// Attempt to create directory and set ownership; ignore failures
$hcpp->run( "mkdir -p $ports_dir && chown -R admin:admin /usr/local/hestia/data/hcpp/ports || true" );
}

// Wipe the existing ports for this domain
if ( file_exists( "/usr/local/hestia/data/hcpp/ports/$user/$domain.ports" ) ) {
unlink( "/usr/local/hestia/data/hcpp/ports/$user/$domain.ports" );
Expand Down Expand Up @@ -846,7 +854,11 @@ public function update_nginx_files( $args ) {
$domain = $args[1];
$nodeapp_folder = "/home/$user/web/$domain/nodeapp";
if ( is_dir( $nodeapp_folder) ) {
$this->generate_nginx_files( $nodeapp_folder, true );
$proxy = $hcpp->run("v-list-web-domain $user $domain json");
if ( $proxy != NULL ) {
$proxy = $proxy[$domain]["PROXY"];
$this->generate_nginx_files( $nodeapp_folder, ( $proxy == "NodeApp" ) );
}
}
}

Expand Down Expand Up @@ -978,4 +990,4 @@ public function v_update_sys_queue( $args ) {
}
global $hcpp;
$hcpp->register_plugin( NodeApp::class );
}
}