So langsam aber sicher sind alle Webserver unter meiner Fuchtel auf Archlinux migriert und haben das auf RHEL basierende CentOS abgelöst. Ich hab vor etwa einem Jahr den ersten Webserver umgestellt und bisher nur gute Erfahrungen gemacht. Die Perfomance der Arch Webserver ist im Vergleich zu den CentOS doch deutlich gestiegen. Das bekommt man mit CentOS doch auch hin werden sicher einige denken. Klar bekommt man das hin, keine Frage, jedoch nur mit erheblichen Mehraufwand. Eine frische Archlinux Installation ist frei von Software die nicht zum Betrieb des Systems benötigt wird. Selbst bei der Minimalinstallation von CentOS muss man erst Dienste deaktivieren die nicht benötigt werden. Somit spart man ne Menge kostbarer Zeit. Die Installation des Grundsystems für dieses Tutorial hat vom Einlegen der “virtuellen” Cd bis zum abschließenden Reboot und Login keine 10 Minuten gedauert.
Der Webserver Lighttpd ist eine wirklich gute Alternative zu Apache. Große Webseiten wie z.B. Teilbereiche von Myspace, imageshack.us und auch der ehemalige Torrent Tracker The Pirate Bay setzen bzw. setzten auf Lighttpd.
1. Vorarbeiten
Das Erste was ich unter einem frischen Archlinux installiere ist das Paket bash-completion. Es ermöglicht das vervollständigen von Befehlen per Tab, hier funktioniert dies aber sogar bei dem Paketmanager.
pacman -Sy bash-completion
Danach ist ein Logout/Login notwendig um die Änderungen wirksam zu machen.
Damit wir uns auch per SSH anmelden können und aus dem kalten Serverraum kommen (sofern es sich um eine physikalische Maschine handelt) installieren wir noch schnell den SSH Daemon.
pacman -Sy openssh
Damit dieser beim Systemstart gleich mitgeladen wird, ergänzen wir die letzte Zeile in der /etc/rc.conf. Die beiden Einträge für Lighty und den Mysqld tragen wir auch gleich ein, wenn wir schonmal dabei sind.
DAEMONS=(syslog-ng network netfs crond sshd lighttpd mysqld)
Um den Dienst manuell zu starten, den Befehl
/etc/rc.d/sshd start
ausführen.
2. Installation
Die benötigten Pakete incl. der Abhängigkeiten werden per
pacman -Sy lighttpd php mysql
installiert.
3. Konfiguration Lighttpd und PHP
Da der Lighttpd, PHP per FastCGI einbindet, müssen wir die entsprechende Sektion in der /etc/lighttpd/lighttpd.conf auskommentieren.
#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi"
)
)
)
Wie im Kommentar bereits angemerkt, ist es ebenso notwendig in der /etc/php/php.ini
cgi.fix_pathinfo = 1
ebanfalls auzukommentieren.
Der Webserver kann jetzt per
/etc/lighttpd start
gestartet werden.
Ob alles seine Richtigkeit hat und funktioniert, überprüfen wir, indem im Document Root /srv/http/ ein PHP File mit folgendem inhalt erstellt wird.
Rufen wir das File im Browser auf, sollte sich folgendes Bild zeigen:
Theoretisch hat man an dieser Stelle schon einen laufenden Webserver.
4. Konfiguration MySQL
Beim ersten Start des MySQL Daemons wird ein Installationsscript ausgeführt, dass gleich die Gruppe und den Benutzer Mysql anlegt.
/etc/rc.d/mysqld start
Ist dies geschehen, beenden wir den Daemon erstmal wieder und starten ihn mit der Option –skip-grant-tables um das Mysql Root Passwort zu setzen.
mysqld_safe --skip-grant-table &
Ein Script nimmt uns die meißte Arbeit ab und entfernt Anonymous User sowie die Beispieltabellen.
root@FB-WEBSRV01 ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Den MySQL einmal durchstarten und wir sind mit der eigentlichen Einrichtung fertig.
Zum Thema VHosts mit Lighttpd komme ich beim nächsten Tutorial.
Kommentare sowie Anregungen und Kritiken sind wie immer ausdrücklich erwünscht.









Kommentare
Es gibt keine Kommentare für diese Verfriemelung.
Senf dazugeben