From 871b338ce958111fb8fdea43c30beeaa0fb82322 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Sun, 21 Sep 2008 14:35:12 +0000
Subject: [PATCH] - Updated ubuntu installation instructions. - Fixed a few
 bugs in suphp implementation.

---
 INSTALL_UBUNTU_8.04.txt                       | 30 ++++++++++++---
 install/lib/installer_base.lib.php            |  5 +++
 install/tpl/apache_ispconfig.vhost.master     | 38 ++++++++-----------
 interface/web/admin/lib/lang/en.lng           |  2 +
 interface/web/admin/lib/module.conf.php       | 20 ++++++++++
 server/conf/vhost.conf.master                 | 17 ++++++---
 .../plugins-available/apache2_plugin.inc.php  |  1 +
 7 files changed, 80 insertions(+), 33 deletions(-)

diff --git a/INSTALL_UBUNTU_8.04.txt b/INSTALL_UBUNTU_8.04.txt
index d681222a67..0de025941f 100644
--- a/INSTALL_UBUNTU_8.04.txt
+++ b/INSTALL_UBUNTU_8.04.txt
@@ -17,10 +17,11 @@ apt-get -u upgrade
 
 1) Install Postfix, Courier, Saslauthd, MySQL, phpMyAdmin with the following command line (on one line!):
 
-apt-get install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl postfix-tls libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl courier-maildrop getmail4
+apt-get install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl courier-maildrop getmail4
 
 Answer the questions from the package manager as follows.
 
+Enter the mysql root password.
 Create directories for web-based administration ? <-- No
 General type of configuration? <-- Internet site
 Mail name? <-- server1.mydomain.tld
@@ -43,6 +44,25 @@ a2enmod suexec
 a2enmod rewrite
 a2enmod ssl
 
+Optional: Install SuPHP
+
+apt-get install libapache2-mod-suphp
+
+vi /etc/suphp/suphp.conf
+
+set docroot to:
+
+docroot=/var/clients
+
+Change:
+
+application/x-httpd-php=php:/usr/bin/php-cgi
+
+to:
+
+x-httpd-php=php:/usr/bin/php-cgi
+
+
 4) Install pure-ftpd and quota
 
 First we have to make sure that the capability module is loaded in the kernel
@@ -61,9 +81,9 @@ echo 'yes' > /etc/pure-ftpd/conf/DontResolve
 apt-get install g++ libc6 gcc gawk make texinfo libmysqlclient15-dev
 
 cd /tmp
-wget http://mydns.bboy.net/download/mydns-1.1.0.tar.gz
-tar xvfz mydns-1.1.0.tar.gz
-cd mydns-1.1.0
+wget http://heanet.dl.sourceforge.net/sourceforge/mydns-ng/mydns-1.2.8.4.tar.gz
+tar xvfz mydns-1.2.8.4.tar.gz
+cd mydns-1.2.8
 ./configure
 make
 make install
@@ -87,7 +107,7 @@ and enter the following lines (between the ----- lines):
 set -e
 
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-DAEMON=/usr/sbin/mydns
+DAEMON=/usr/local/sbin/mydns
 NAME=mydns
 DESC="DNS server"
 
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index c1780d91be..84ceea890b 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -610,6 +610,11 @@ class installer_base {
 		//* Create the logging directory for the vhost logfiles
 		exec('mkdir -p /var/log/ispconfig/httpd');
 		
+		if(is_file('/etc/suphp/suphp.conf')) {
+			replaceLine('/etc/suphp/suphp.conf','application/x-httpd-php=php:/usr/bin/php-cgi','x-httpd-suphp=php:/usr/bin/php-cgi',0);
+			replaceLine('/etc/suphp/suphp.conf','docroot=','docroot=/var/clients',0);
+		}
+		
 	}
 	
 	public function configure_firewall()
diff --git a/install/tpl/apache_ispconfig.vhost.master b/install/tpl/apache_ispconfig.vhost.master
index 0e646fde63..023fb438b9 100644
--- a/install/tpl/apache_ispconfig.vhost.master
+++ b/install/tpl/apache_ispconfig.vhost.master
@@ -12,34 +12,28 @@ NameVirtualHost *:{vhost_port}
     DocumentRoot /usr/local/ispconfig/interface/web/
 	
 	<IfModule mod_fastcgi.c>
-		<Location /php/php-fcgi>
-                	Options ExecCGI        
-                	SetHandler fastcgi-script
-       		</Location>
-
-        	Action php-fastcgi /php/php-fcgi
-
-		ScriptAlias /php/ /usr/local/ispconfig/interface/bin/
-
-		<Directory "/usr/local/ispconfig/interface/bin/">
-                        AllowOverride None
-                        Options +ExecCGI -MultiViews -Indexes
-                        Order allow,deny
-                        Allow from all                              
-        	</Directory>
+		SuexecUserGroup ispconfig ispconfig
+		<Directory /var/www/ispconfig/>
+                Options Indexes FollowSymLinks MultiViews +ExecCGI
+                AllowOverride AuthConfig Indexes Limit Options FileInfo
+                AddHandler fcgid-script .php
+                FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/php-fcgi-starter .php
+                AllowOverride None
+                Order allow,deny
+                Allow from all
+        </Directory>
 	</IfModule>
 
 	<IfModule mod_php5.c>
   		AddType application/x-httpd-php .php
+		<Directory /usr/local/ispconfig/interface/web>
+			Options FollowSymLinks
+			AllowOverride None
+			Order allow,deny
+			Allow from all
+		</Directory>
 	</IfModule>
 	
-	<Directory /usr/local/ispconfig/interface/web/>
-		Options FollowSymLinks
-		AllowOverride None
-		Order allow,deny
-		Allow from all
-	</Directory>
-	
 	# ErrorLog /var/log/apache2/error.log
 	# CustomLog /var/log/apache2/access.log combined
     ServerSignature Off
diff --git a/interface/web/admin/lib/lang/en.lng b/interface/web/admin/lib/lang/en.lng
index 9699e3b8f2..4d0b01de95 100644
--- a/interface/web/admin/lib/lang/en.lng
+++ b/interface/web/admin/lib/lang/en.lng
@@ -31,5 +31,7 @@ $wb['New Language'] = 'New Language';
 $wb['Export'] = 'Export';
 $wb['Import'] = 'Import';
 $wb['Language Editor'] = 'Language Editor';
+$wb['Software'] = 'Software';
+$wb['Repositories'] = 'Repositories';
 
 ?>
\ No newline at end of file
diff --git a/interface/web/admin/lib/module.conf.php b/interface/web/admin/lib/module.conf.php
index 4a730654f6..a37dd96969 100644
--- a/interface/web/admin/lib/module.conf.php
+++ b/interface/web/admin/lib/module.conf.php
@@ -85,6 +85,25 @@ $module['nav'][] = array(	'title'	=> 'Firewall',
 // cleanup
 unset($items);
 
+
+$items[] = array( 'title' 	=> 'Repositories',
+				  'target' 	=> 'content',
+				  'link'	=> 'admin/software_repo_list.php');
+
+
+
+$module['nav'][] = array(	'title'	=> 'Software',
+							'open' 	=> 1,
+							'items'	=> $items);
+
+
+// cleanup
+unset($items);
+
+
+
+
+/*
 $items[] = array( 'title' 	=> 'Add user',
 				  'target' 	=> 'content',
 				  'link'	=> 'admin/dbsync_edit.php');
@@ -105,6 +124,7 @@ $module['nav'][] = array(	'title'	=> 'DB Sync.',
 
 // cleanup
 unset($items);
+*/
 
 
 
diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master
index 7259b5fa4e..4ba04e6503 100644
--- a/server/conf/vhost.conf.master
+++ b/server/conf/vhost.conf.master
@@ -1,6 +1,11 @@
 
 <VirtualHost <tmpl_var name='ip_address'>:80>
-    DocumentRoot <tmpl_var name='web_document_root'>
+	<tmpl_if name='php' op='==' value='suphp'>
+	DocumentRoot <tmpl_var name='web_document_root'>
+	</tmpl_else>
+	DocumentRoot <tmpl_var name='web_document_root_www'>
+	</tmpl_if>
+    
     ServerName <tmpl_var name='domain'>
 	ServerAdmin webmaster@<tmpl_var name='domain'>
 	ErrorLog <tmpl_var name='document_root'>/log/error.log
@@ -13,7 +18,7 @@
 	ErrorDocument 500 /error/internalServerError.html
 	ErrorDocument 503 /error/overloaded.html
 	
-    <Directory <tmpl_var name='web_document_root'>/>
+    <Directory {tmpl_var name='web_document_root_www'}>
         Options None
         AllowOverride Indexes AuthConfig Limit FileInfo
         Order allow,deny
@@ -43,12 +48,12 @@
     AddType application/x-httpd-php .php .php3 .php4 .php5
 </tmpl_if>
 <tmpl_if name='php' op='==' value='suphp'>
-    <Directory <tmpl_var name='web_document_root'>/>
+    <Directory {tmpl_var name='web_document_root'}>
     # suphp enabled
     suPHP_Engine on
     # suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
-    AddHandler x-httpd-php .php .php3 .php4 .php5
-    suPHP_AddHandler x-httpd-php
+    AddHandler x-httpd-suphp .php .php3 .php4 .php5
+    suPHP_AddHandler x-httpd-suphp
 	</Directory>
 </tmpl_if>
 <tmpl_if name='php' op='==' value='cgi'>
@@ -57,7 +62,7 @@
 </tmpl_if>
 <tmpl_if name='php' op='==' value='fast-cgi'>
      # php as fast-cgi enabled
-    <Directory /var/www/<tmpl_var name='domain'>/web>
+    <Directory {tmpl_var name='web_document_root_www'}>
         AddHandler fcgid-script .php .php3 .php4 .php5
         FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php
         Options FollowSymLinks +ExecCGI Indexes
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index af9371d7cd..cb169e9ba9 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -337,6 +337,7 @@ class apache2_plugin {
 		
 		$vhost_data = $data["new"];
 		$vhost_data["web_document_root"] = $data["new"]["document_root"]."/web";
+		$vhost_data["web_document_root_www"] = "/var/www/".$data["new"]["domain"]."/web";
 		
 		// Check if a SSL cert exists
 		$ssl_dir = $data["new"]["document_root"]."/ssl";
-- 
GitLab