@@ -970,6 +970,67 @@ public function configure_vlogger()
970970 exec ('chown root:root ' .$ conf ["vlogger " ]["config_dir " ].'/ ' .$ configfile );
971971
972972 }
973+
974+ public function install_apps_vhost ()
975+ {
976+ global $ conf ;
977+
978+ //* Create the ispconfig apps vhost user and group
979+
980+ $ apps_vhost_user = $ conf ['web ' ]['apps_vhost_user ' ];
981+ $ apps_vhost_group = $ conf ['web ' ]['apps_vhost_group ' ];
982+
983+ $ command = 'groupadd ' .$ apps_vhost_user ;
984+ if (!is_group ($ apps_vhost_group )) caselog ($ command .' &> /dev/null 2> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
985+
986+ $ command = "useradd -g ' $ apps_vhost_group' -d $ install_dir $ apps_vhost_group " ;
987+ if (!is_user ($ apps_vhost_user )) caselog ($ command .' &> /dev/null 2> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
988+
989+
990+ $ command = 'adduser ' .$ conf ['apache ' ]['user ' ].' ' .$ apps_vhost_group ;
991+ caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
992+
993+ //* Copy the apps vhost file
994+ $ vhost_conf_dir = $ conf ['apache ' ]['vhost_conf_dir ' ];
995+ $ vhost_conf_enabled_dir = $ conf ['apache ' ]['vhost_conf_enabled_dir ' ];
996+ $ apps_vhost_servername = ($ conf ['apache ' ]['apps_vhost_servername ' ] == '' )?'' :'ServerName ' .$ conf ['apache ' ]['apps_vhost_servername ' ];
997+
998+ // Dont just copy over the virtualhost template but add some custom settings
999+ $ content = rf ("tpl/apache_apps.vhost.master " );
1000+
1001+ $ content = str_replace ('{apps_vhost_ip} ' , $ conf ['apache ' ]['apps_vhost_ip ' ], $ content );
1002+ $ content = str_replace ('{apps_vhost_port} ' , $ conf ['apache ' ]['apps_vhost_port ' ], $ content );
1003+ $ content = str_replace ('{apps_vhost_dir} ' , $ conf ['web ' ]['website_basedir ' ].'/apps ' , $ content );
1004+ $ content = str_replace ('{apps_vhost_servername} ' , $ apps_vhost_servername , $ content );
1005+
1006+
1007+ // comment out the listen directive if port is 80 or 443
1008+ if ($ conf ['apache ' ]['apps_vhost_ip ' ] == 80 or $ conf ['apache ' ]['apps_vhost_ip ' ] == 443 ) {
1009+ $ content = str_replace ('{vhost_port_listen} ' , '# ' , $ content );
1010+ } else {
1011+ $ content = str_replace ('{vhost_port_listen} ' , '' , $ content );
1012+ }
1013+
1014+ wf ("$ vhost_conf_dir/apps.vhost " , $ content );
1015+
1016+ //copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
1017+ //* and create the symlink
1018+ if ($ this ->install_ispconfig_interface == true && $ this ->is_update == false ) {
1019+ if (@is_link ("$ vhost_conf_enabled_dir/apps.vhost " )) unlink ("$ vhost_conf_enabled_dir/apps.vhost " );
1020+ if (!@is_link ("$ vhost_conf_enabled_dir/000-apps.vhost " )) {
1021+ exec ("ln -s $ vhost_conf_dir/apps.vhost $ vhost_conf_enabled_dir/000-apps.vhost " );
1022+ }
1023+ }
1024+ if (!is_file ($ conf ['web ' ]['website_basedir ' ].'/php-fcgi-scripts/apps/.php-fcgi-starter ' )) {
1025+ exec ('mkdir -p ' .$ conf ['web ' ]['website_basedir ' ].'/php-fcgi-scripts/apps ' );
1026+ exec ('cp tpl/apache_apps_fcgi_starter.master ' .$ conf ['web ' ]['website_basedir ' ].'/php-fcgi-scripts/apps/.php-fcgi-starter ' );
1027+ exec ('chmod +x ' .$ conf ['web ' ]['website_basedir ' ].'/php-fcgi-scripts/apps/.php-fcgi-starter ' );
1028+ exec ('ln -s /usr/local/apps/interface/web ' .$ conf ['web ' ]['website_basedir ' ].'/apps ' );
1029+ exec ('chown -R ispapps:ispapps ' .$ conf ['web ' ]['website_basedir ' ].'/php-fcgi-scripts/apps ' );
1030+
1031+ }
1032+
1033+ }
9731034
9741035 public function install_ispconfig ()
9751036 {
0 commit comments