![]() |
|
howto / config-webserver how to build and configure your webserver:
This can be a complicated process, involving many steps. Although people who have experience compiling autoconf'ed packages shouldn't have a problem. Essentially, these are instructions gathered from the various README or INSTALL files. They are intended to be followed as a rough guideline for getting a LAMP installation up and running - each administrator will need to customize the options for themselves. The first configuration for Apache doesn't actually build it, but creates the necessary files for building php. Note: There are a few references to files or directories below that are noted with 'xx' in them. These are replacements for whichever the current versio numbers are. download fresh source grab the latest stable tar.gz version of these packages into /usr/local/src/ http://httpd.apache.org/dist/httpd/ http://www.php.net/downloads.php https://www.zend.com/download.php http://dev.mysql.com/downloads/ If you don't intend to serve secure pages, then you can skip any of the below sections that mention SSL. Otherwise, if you're planning on building SSL into your webserver, you'll need to grab the SSL packages: http://www.modssl.org/source/ http://www.openssl.org/source/ make a backup copy of apache cd /usr/local/ cp -r apache/ apache-old unpack the source code cd src/ gunzip package-name.tar.gz tar -tf package-name.tar | more tar -xvf package-name.tar build openssl ./config make make test make install configure mod_ssl ./configure --enable-shared=ssl --with-apache=../apache_1.x.xx quick-pass configure apache ./configure build mysql This is the quick and dirty method, taken from the INSTALL-SOURCE directions. groupadd mysql useradd -g mysql mysql gunzip < mysql-VERSION.tar.gz | tar -xvf - cd mysql-VERSION ./configure --prefix=/usr/local/mysql make make install # necessary only if you haven't installed MySQL before: scripts/mysql_install_db chown -R root /usr/local/mysql chown -R mysql /usr/local/mysql/var chgrp -R mysql /usr/local/mysql cp support-files/my-medium.cnf /etc/my.cnf cp support-files/mysql.server /etc/init.d/mysql /usr/local/mysql/bin/safe_mysqld --user=mysql & After this, it's a very good idea to secure your installation. It can be a wise idea to require every user on the machine to use their own password. Remember - these passwords are independent of the login password. /usr/local/mysql/bin/mysql DELETE FROM user WHERE User=''; GRANT ALL ON * to root@localhost IDENTIFIED BY 'set_a_password'; At this point, it might be a good idea to test your startup/shutdown script: /etc/init.d/mysql stop|start build php Note: The compilation of php requires gnu's version of make, also known as gmake. On many linux systems, these are the same. If your system does not have gmake, you may need to build it before building php. cd ../php-5.x ./configure --with-mysql --with-apache=../apache_1.x.xx \ --enable-md5 --with-config-file-path=/etc make clean make make install copy php libraries into place #pull over changes from the new php.ini-recommended to your version vimdiff /etc/php.ini /usr/local/src/php-x.x.x/php.ini-recommended copy Zend optimizer plug-in to proper place cd ../ZendOptimizer-0.xx-php5.x.x-Linux-glibcX #check to see if there is an old version: ll /usr/local/Zend/lib/ZendOptimizer.so #if so, then make a backup copy of old plug-in cp /usr/local/Zend/lib/ZendOptimizer.so /usr/local/Zend/lib/ZendOptimizer.so-old #if not, then mkdir /usr/local/Zend mkdir /usr/local/Zend/lib #finally, cp ZendOptimizer.so /usr/local/Zend/lib/ZendOptimizer.so do a final build on apache To use Apache's mod_rewrite, it must be passed as a variable in the configure step. This flag is optional, as it does put an extra strain on the CPU, though allows you to maintain "cool" URIs. The mod_rewrite module should have come bundled with your Apache source code, though it won't be enabled without being told to. cd /usr/local/src/apache_1.x.xx ./configure --prefix=/usr/local/apache --enable-module=ssl \ --activate-module=src/modules/php5/libphp5.a --enable-module=rewrite make make certificate #if you're using SSL make install edit configuration to recognize php files edit /usr/local/apache/conf/httpd.conf, and remove comments where it says: # And for PHP 5.x, use: # AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps test and start httpd with SSL enabled If apache is currently running, you'll need to halt it before starting the newly compiled version. /etc/init.d/httpd stop #this will alert you to configuration issues before attempting to start apache /usr/local/apache/bin/apachectl configtest /usr/local/apache/bin/apachectl start #or startssl if running with SSL Once you are confident with the way that your server is running, you will probably want to start up automatically when/if the machine reboots. Copying this file and making the appropriate entry in chkconfig (as root) should make this happen. Testing of these features, is of course a rather wise move.
$Id: config-webserver.html,v 1.32 2007/02/05 04:40:46 willn Exp $ |