12 Apache2 Mit PHP
Jetzt installieren wir Apache mit PHP (PHP 5.1.6):
yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel
Bearbeite dann /etc/httpd/conf/httpd.conf:
vi /etc/httpd/conf/httpd.conf
und ändere DirectoryIndex zu
[...] DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl [...] |
Konfiguriere Dein System nun um Apache beim Hochfahren zu starten:
chkconfig --levels 235 httpd on
Starte Apache:
/etc/init.d/httpd start
12.1 PHP Global Deaktivieren
(Wenn Du nicht vorhast, ISPConfig auf diesem Server zu installieren, bitte überspringe dieses Kapitel!)
In ISPConfig wirst Du PHP pro Website konfigurieren, das heißt Du kannst festlegen, welche Website PHP Skripte laufen lassen kann und welche nicht. Dies kann nur funktionieren, wenn PHP global deaktiviert ist, da sonst alle Websites in der Lage wären, PHP Skripte laufen zu lassen, egal was Du in ISPConfig festlegst.
Um PHP global zu deaktivieren, bearbeiten wir /etc/httpd/conf.d/php.conf und kommentieren die AddHandler und AddType Zeile aus:
vi /etc/httpd/conf.d/php.conf
# # PHP is an HTML-embedded scripting language which attempts to make it # easy for developers to write dynamically generated webpages. # LoadModule php5_module modules/libphp5.so # # Cause the PHP interpreter to handle files with a .php extension. # #AddHandler php5-script .php #AddType text/html .php # # Add index.php to the list of files that will be served as directory # indexes. # DirectoryIndex index.php # # Uncomment the following line to allow PHP to pretty-print .phps # files as PHP source code: # #AddType application/x-httpd-php-source .phps |
Danach starten wir Apache neu:
/etc/init.d/httpd restart
13 ProFTPd
ISPConfig liefert eine bessere Unterstützung für proftpd als vsftpd, also lass uns vsftpd entfernen:
yum remove vsftpd
Da CentOS kein proftpd Paket hat, müssen wir Proftpd manuell erstellen:
cd /tmp/
wget --passive-ftp ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.1.tar.gz
tar xvfz proftpd-1.3.1.tar.gz
cd proftpd-1.3.1/
./configure --sysconfdir=/etc
make
make install
cd ..
rm -fr proftpd-1.3.1*
Das proftpd Binärpaket wird in /usr/local/sbin installiert, aber wir benötigen es in /usr/sbin, also erstellen wir einen Symlink:
ln -s /usr/local/sbin/proftpd /usr/sbin/proftpd
Erstelle nun das init Skript /etc/init.d/proftpd:
vi /etc/init.d/proftpd
#!/bin/sh
# $Id: proftpd.init,v 1.1 2004/02/26 17:54:30 thias Exp $
#
# proftpd This shell script takes care of starting and stopping
# proftpd.
#
# chkconfig: - 80 30
# description: ProFTPD is an enhanced FTP server with a focus towards
# simplicity, security, and ease of configuration.
# It features a very Apache-like configuration syntax,
# and a highly customizable server infrastructure,
# including support for multiple 'virtual' FTP servers,
# anonymous FTP, and permission-based directory visibility.
# processname: proftpd
# config: /etc/proftp.conf
# pidfile: /var/run/proftpd.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x /usr/sbin/proftpd ] || exit 0
RETVAL=0
prog="proftpd"
start() {
echo -n $"Starting $prog: "
daemon proftpd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/proftpd
}
stop() {
echo -n $"Shutting down $prog: "
killproc proftpd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/proftpd
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status proftpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/proftpd ]; then
stop
start
fi
;;
reload)
echo -n $"Re-reading $prog configuration: "
killproc proftpd -HUP
RETVAL=$?
echo
;;
*)
echo "Usage: $prog {start|stop|restart|reload|condrestart|status}"
exit 1
esac
exit $RETVAL
|
Danach machen wir das init Skript ausführbar:
chmod 755 /etc/init.d/proftpd
Als Nächstes öffnen wir /etc/proftpd.conf und ändern Group zu nobody:
vi /etc/proftpd.conf
[...] Group nobody [...] |
Aus Sicherheitsgründen kannst Du auch folgende Zeilen /etc/proftpd.conf hinzufügen (dank Reinaldo Carvalho; mehr Informationen findest Du hier: http://proftpd.org/localsite/Userguide/linked/userguide.html):
vi /etc/proftpd.conf
[...] DefaultRoot ~ IdentLookups off ServerIdent on "FTP Server ready." [...] |
Nun können wir die System Starup Links für Proftpd erstellen:
chkconfig --levels 235 proftpd on
Und letztendlich starten wir Proftpd:
/etc/init.d/proftpd start
14 Webalizer
Um Webalizer zu installieren, lass einfach Folgendes laufen
yum install webalizer
15 Synchronisation Der System-Uhr
Wenn Du möchtest, dass die System-Uhr mit einem NTP Server synchronisiert werden soll, führe Folgendes aus:
yum install ntp
chkconfig --levels 235 ntpd on
ntpdate 0.pool.ntp.org
/etc/init.d/ntpd start
16 Installiere einige Perl Module
In ISPConfig ist SpamAssassin dabei, welches ein paar Perl Module benötigt, um richtig zu funktionieren. Mit nur einem Befehl installieren wir die benötigten Perl Module:
yum install perl-HTML-Parser perl-DBI perl-Net-DNS perl-Digest-SHA1
17 Das Ende
Die Konfiguration des Servers ist nun abgeschlossen. Wenn Du möchtest, kannst Du nun ISPConfig installieren.
17.1 Eine Notiz für SuExec
Wenn Du CGI Skripte unter suExec laufen lassen möchtest, solltest Du /var/www als Home Verzeichnis für Websites festlegen, die von ISPConfig erstellt wurden, da CentOS’ suExec mit /var/www as Doc_Root erstellt wird. Lass Folgendes laufen
/usr/sbin/suexec -V
und die Ausgabe sollte so aussehen:
[root@server1 ~]# /usr/sbin/suexec -V
-D AP_DOC_ROOT=”/var/www”
-D AP_GID_MIN=100
-D AP_HTTPD_USER=”apache”
-D AP_LOG_EXEC=”/var/log/httpd/suexec.log”
-D AP_SAFE_PATH=”/usr/local/bin:/usr/bin:/bin”
-D AP_UID_MIN=500
-D AP_USERDIR_SUFFIX=”public_html”
[root@server1 ~]#
Wenn Du also suExec mit ISPconfig verwenden möchtest, ändere nicht den Standard-Web-Root (was /var/www ist) wenn Du den Expertenmodus während der ISPConfig Installation verwendest (im Standardmodus kannst Du den Web-Root sowieso nicht ändern, also kannst Du suExec in jedem Fall verwenden).
18 Links
- CentOS: http://www.centos.org
- ISPConfig: http://www.ispconfig.org
- CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (auch bekannt als Der Perfekte Server) - Seite 1
- CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (auch bekannt als Der Perfekte Server) - Seite 2
- CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (auch bekannt als Der Perfekte Server) - Seite 3
- CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (auch bekannt als Der Perfekte Server) - Seite 4
- CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (auch bekannt als Der Perfekte Server) - Seite 5
- CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (auch bekannt als Der Perfekte Server) - Seite 6

