@@ -584,6 +584,54 @@ public function configure_apache()
584584
585585 }
586586
587+ public function configure_nginx (){
588+ global $ conf ;
589+
590+ if ($ conf ['nginx ' ]['installed ' ] == false ) return ;
591+ //* Create the logging directory for the vhost logfiles
592+ if (!@is_dir ($ conf ['ispconfig_log_dir ' ].'/httpd ' )) mkdir ($ conf ['ispconfig_log_dir ' ].'/httpd ' , 0755 , true );
593+
594+ // Sites enabled and avaulable dirs
595+ exec ('mkdir -p ' .$ conf ['nginx ' ]['vhost_conf_enabled_dir ' ]);
596+ exec ('mkdir -p ' .$ conf ['nginx ' ]['vhost_conf_dir ' ]);
597+
598+ $ content = trim (rf ('/etc/nginx/nginx.conf ' ));
599+ $ content = substr ($ content ,0 ,-1 )."\n include /etc/nginx/sites-enabled/*.vhost; \n} " ;
600+ wf ('/etc/nginx/nginx.conf ' ,$ content );
601+ unset($ content );
602+
603+ // create PHP-FPM pool dir
604+ exec ('mkdir -p ' .$ conf ['nginx ' ]['php_fpm_pool_dir ' ]);
605+
606+ $ content = rf ('/etc/php5/fpm/php-fpm.conf ' );
607+ if (stripos ($ content , 'include=/etc/php5/fpm/pool.d/*.conf ' ) === false ){
608+ af ('/etc/php5/fpm/php-fpm.conf ' ,"\ninclude=/etc/php5/fpm/pool.d/*.conf " );
609+ }
610+ unset($ content );
611+
612+ //* make sure that webalizer finds its config file when it is directly in /etc
613+ if (@is_file ('/etc/webalizer.conf ' ) && !@is_dir ('/etc/webalizer ' )) {
614+ mkdir ('/etc/webalizer ' );
615+ symlink ('/etc/webalizer.conf ' ,'/etc/webalizer/webalizer.conf ' );
616+ }
617+
618+ if (is_file ('/etc/webalizer/webalizer.conf ' )) {
619+ // Change webalizer mode to incremental
620+ replaceLine ('/etc/webalizer/webalizer.conf ' ,'#IncrementalName ' ,'IncrementalName webalizer.current ' ,0 ,0 );
621+ replaceLine ('/etc/webalizer/webalizer.conf ' ,'#Incremental ' ,'Incremental yes ' ,0 ,0 );
622+ replaceLine ('/etc/webalizer/webalizer.conf ' ,'#HistoryName ' ,'HistoryName webalizer.hist ' ,0 ,0 );
623+ }
624+
625+ // Check the awsatst script
626+ if (!is_dir ('/usr/share/awstats/tools ' )) exec ('mkdir -p /usr/share/awstats/tools ' );
627+ if (!file_exists ('/usr/share/awstats/tools/awstats_buildstaticpages.pl ' ) && file_exists ('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl ' )) symlink ('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl ' ,'/usr/share/awstats/tools/awstats_buildstaticpages.pl ' );
628+ if (file_exists ('/etc/awstats/awstats.conf.local ' )) replaceLine ('/etc/awstats/awstats.conf.local ' ,'LogFormat=4 ' ,'LogFormat=1 ' ,0 ,1 );
629+
630+ //* add a sshusers group
631+ $ command = 'groupadd sshusers ' ;
632+ if (!is_group ('sshusers ' )) caselog ($ command .' &> /dev/null 2> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
633+ }
634+
587635 public function configure_firewall ()
588636 {
589637 global $ conf ;
0 commit comments