PROMO SELL

Tuesday, March 08, 2005

Apache/PHP/MySQL with SSL Installation

# Move to /usr/local
cd /usr/local
# Get the following source:

ftp://ftp.openssl.org/source/openssl-0.9.7c.tar.gz
http://www.ibiblio.org/pub/mirrors/apache/httpd/httpd-2.0.48.tar.gz
http://www.linuxguruz.org/downloads/php-4.3.4.tar.gz
http://mysql.secsup.org/Downloads/MySQL-4.0/mysql-4.0.17.tar.gz



# Decompress the sources:
tar -xvzf openssl-0.9.7c.tar.gz
tar -xvzf httpd-2.0.48.tar.gz
tar -xvzf php-4.3.4.tar.gz
tar -xvzf mysql-4.0.17.tar.gz

cd ../mysql-4.0.17
./configure
make
make install
scripts/mysql_install_db

adduser mysql
# In the file /etc/login.access add this line:
-:mysql:ALL
# So the user mysql never actualy logs in

# For Slackware:
chown -R mysql.users /usr/local/var
# For Redhat:
chown -R mysql.mysql /usr/local/var

mysqld_safe --user=mysql &

# Hit
mysqladmin -u root password 'yourpasswordhere'

cd ../openssl-0.9.7c
sh config -fPIC
make
# If you get a "Not enough room for program headers" error here,
# install the LATEST version of binutils.

cd ../httpd-2.0.48
SSL_BASE=../openssl-0.9.7c ./configure --prefix=/usr/local/apache --enable-module=all --enable-ssl --enable-so
make

# Note: There is a Redhat bug that complains about mod_auth_dbm.so
# during the Apache `make` proccess. Adding the configuration
# switch --disable-module=auth_dbm to the end of the ./configure line
# will fix it.

# If you presently have a libphp4.so module you should make a backup:
cp /usr/local/apache/modules/libphp4.so /usr/local/apache/modules/libphp4.so.was

# If you have a file called /usr/local/apache/conf/httpd.conf already you
# should make a backup:
mv /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.was

# This way you'll get a fresh httpd.conf with all your Apache modules listed
# and 100% loadable.

# Don't worry if your web server is presently running. The httpd.conf file
# is only read by the httpd binary when starting the web server.

make install

# Now to create a "test certificate".
cd /usr/local/apache/conf/
openssl genrsa -des3 -out ca.key 1024
# Note: In order to go live, the "Common Name" has to match the server's
# host adress.
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
openssl genrsa -des3 -out server.key 1024
openssl req -new -days 365 -key server.key -out server.crt

wget http://www.linuxguruz.com/downloads/sign.sh
chmod +x sign.sh
./sign.sh server.crt
chmod -x sign.sh
mkdir ssl.crt ssl.key
cp server.crt ssl.crt
cp server.key ssl.key

#
cd ../php-4.3.4
./configure --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --enable-versioning --with-mysql=/usr/local --enable-ftp --enable-bcmath --disable-debug --enable-memory-limit=yes --enable-track-vars
make
make install

# Make sure you have, Uncomment (remove the #'s), Change or Create
# the following lines in the file /usr/local/apache/conf/httpd.conf

LoadModule php4_module libexec/libphp4.so


DirectoryIndex index.html index.php index.php3 index.phtml

# And for PHP 4.x, use:
#
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps

cp /usr/local/php-4.3.4/php.ini-dist /usr/local/apache/conf/php.ini

# Start Apache:
/usr/local/apache/bin/apachectl startssl

# Create a file in /usr/local/apache/htdocs called index.php
-html-
-head--title-PHP Test Page-/title--/head-
-body-
-? phpinfo(); ?-
-/body-
-/html-

# Point your Web Browser at:
http://localhost/index.php

Anyone who wishes to make additions or changes to this
PHP Tutorial email them to webmaster@linuxguruz.com

No comments: