Help File Library: Setting Up Apache with mySQL, Frontpage 2000 Extensions,
and PHP
Written By:
Dallas Engelken
- Any line starting with "#" is a command to be ran as root on your box.
- Any line starting with ">" is a configuration file entry in which the
">" can be ignored.
- Currently the method of order to get a working install is.
-- Install mysql.
-- Patch the Apache Source with Frontpage 2000 patch
-- A simple Apache configure (no make or install)
-- Configure make and make install PHP with apache and mysql support
-- Configure apache with activate module php4 and add module mod_fontpage.c
that was created from patch
-- Make and Make install Apache
-- Apply frontpage extensions to DocumentRoot using fpsrvadm.exe
1. download the following packages to /downloads
- apache_1.3.19.tar.gz - www.apache.org
- fp40.linux.tar.gz - www.rtr.com
- mysql-3.23.32.tar.gz - www.mysql.org
- php-4.0.4pl1.tar.gz - www.php.net
2. extract all packages in /download execpt
for frontpage which will need to extract to /usr/local
# tar zxfv apache_1.3.19.tar.gz
# tar zxfv fp40.linux.tar.gz -C /usr/local
# tar zxfv mysql-3.23.32.tar.gz
# tar zxfv php-4.0.4pl1.tar.gz
3. First install mysql.
# cd /downloads/mysql-3.23.32
# groupadd mysql
# useradd -g mysql mysql
# ./configure --prefix=/usr/local/mysql
# make
# make install
# scripts/mysql_install_db
# chown -R mysql.mysql /usr/local/mysql
# /usr/local/mysql/bin/safe_mysqld --user=mysql &
Now mysql is up and running, might wanna set a root password on
mysqladmin
# /usr/local/mysql/bin/mysqladmin -u root password 'yourpass'
4. Copy the Frontpage patch over to the apache source directory and make a sym
link to currentversion of frontpage:
# ln -s /usr/local/frontpage/version4.0
/usr/local/frontpage/currentversion
# cp
/usr/local/frontpage/currentversion/apache-fp/fp-patch-apache_1.3.12/downloads/apache_1.3.19
5. Now apply the frontpage patch to the apache source directory. This
will require the patch binary to be in place in your path. download the
patch rpm and install it if needed.
# cd /downloads/apache_1.3.19
# patch -p0 < fp-patch-apache_1.3.12
This will create mod_frontpage.c in the apahce source root. It needs to
be copied over to extra modules folder.
# cp mod_frontpage.c src/modules/extra/
6. Now run a simple configure, we will run a more advanced one in a bit.
# /downloads/apache_1.3.19/configure
7. Let now set up PHP with mySQL support. You will be installing with
mysql in /usr/local/mysql because it is already install, and installing
with apache in your current source dir /downloads/apache_1.3.19 because
you have not ran make on apache yet.
# cd /downloads/php-4.0.4pl1
# ./configure --with-mysql=/usr/local/mysql
--with-apache=/downloads/apache_1.3.19 --enable-track-vars
# make
# make install
8. Now that php has been made, you will find a new directory in your
apache source, ../apache_1.3.19/src/modules/php4.
We will now configure apache yet again with PHP support and Frontpage
support built in statically.
I also like to set up a symbolic link from /usr/local/httpd to
/usr/local/apache-1.3.x so you can just make a new version of apache and
then redo the symlink when necessary. To do so, type:
# mkdir /usr/local/apache-1.3.19
# ln -s /usr/local/apache-1.3.19 /usr/local/httpd
Now we can configure apache with the --prefix=/usr/local/httpd
and it will symlink to apache-1.3.19 for us. If you want your httpd.conf
file to be in /etc, make sure you add --localstatedir=/etc
to your ./configure command. Otherwise, your httpd.conf will be in
/usr/local/httpd/conf which is fine with me.
# cd /downloads/apache_1.3.19
# ./configure --prefix=/usr/local/httpd
--activate-module=src/modules/php4/libphp4.a
--add-module=src/modules/extra/mod_frontpage.c
Yes I know, src/modules/php4/libphp4.a does not
exist, but it will...that's what the Makefile is there for. Now make and
make install apache
# make
# make install
9. Great, you have installed Apache 1.3.19 with Frontpage, PHP, and mySQL
support. Now lets wrap some other things up so this
all works.
First some httpd.conf configuration changes. Make sure you have the following
2 lines uncommented in your configuration file.
Ignore the ">" as there are only indentions to show the configuration lines.
Sensei's Note:
I edited alot of the ">" out of the Help File, but if you see them and they look
like they do not belong, let me know and I'll remove them.
Leave the php3 lines commented still, as we are
installing PHP4, not version 3.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
I also change the DirectoryIndex support to add index.php and index.shtml
so it will look like this:
DirectoryIndex index.php index.shtml index.html index.htm
A couple other important changes that need to be made to the
configuration file are in the DocumentRoot and Directory accesses.
First change the document root to where your default page will be, i set
this to:
DocumentRoot /www/httpd
Now change directory permissions on this so that Frontpage can override
them with their .htaccess files. AllowOverride is changed from None to
All:
<Directory "/www/httpd">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
If you are doing virtual webs, follow the same format in adding them.
I'll go into this further as I get into it further.
10. Now lets apply the frontpage extensions to our root web.
(/www/httpd).
running change_server.sh may be a pointless step... just dont say Y and
overwrite your apache binary or all that work you just did goes down the
drain.
# /usr/local/frontpage/currentversion/change_server.sh
Say Y to satisfied with backup.
Say /usr/local/httpd/bin/httpd to where the
daemon is located.
IMPORTANT : Say N to replacing the stock apache!!
Now change to the bin directory:
# cd /usr/local/frontpage/currentversion/bin/
And run fpsrvadm.exe to install extensions into the
root web.
# ./fpsrvadm.exe -o install
Choose 0 for apache (do not chooose apache-fp because we have already patched
and statically compiled) Enter /usr/local/httpd/conf/httpd.conf for your server config
file.
Just hit enter for a blank multi-hosting.
For the Unix username, enter web or apache or whoever you want to own the
DocumentRoot (i.e. /www/httpd)
For the Unix group, enter web or apache or whoever you want to own the group
of DocumentRoot (i.e. /www/httpd)
Note: I use user: apache, group: web myself
Sensei's Note: Many people use the default: nobody:nobody for user
and group.
Then simply provide an account for administrator to the front page and
password for that account. This will be the login and password you use to
access it via Frontpage, which is probably better if you keep it in sync
with the ftp login. You can always come back and run ./fpsrvadm.exe
and add a user to it using Option 7 and entering the correct info. Or
you can modify /_vti_pvt/service.pwd which
contains the users, and their encrypted passwords, that can log into the
Frontpage. If you need to make the encrypted password, use the:
# htpasswd temp.file <my-new-user>
# Enter Password : **********
# pico temp.file
Contents of temp.pass >>>> <my-new-user>:3923kw#$sdfk32$
And then just copy the user and encrypted password to service.pwd file and
that use can log in. You will also have to group that user so modifications to
the site can be made. This is done by editing /_vti_pvt/service.grp
# pico _Vti_pvt/service.grp
Contents of service.grp >>>> administrators : administrator
<my-new-user> authors :
Simply add your new user to whatever group you see fit to modify the
site. Now try the login and password through frontpage and the user should
have editing rights after the addition to the "authors" or
"administrators" group.
11. To add frontpage support to a virtual web:
First, edit your httpd.conf and uncomment the NameVirtualHost line. If
you only have 1 ip address on this box, then your root web is history.
The first virtual host in the list will be your root web. If you have 2
ip addresses for the box, then your root web might be on 192.168.0.1 and
your Virtual webs could be on 192.168.0.2. This would keep your root web
intact.
NameVirtualHost * # do it this way if you have 1 ip
address
NameVirtualHost 192.168.0.2 # if you have a separate ip address just
for your virtual webs
Make sure if you have multiple ip addresses, you tell apache what ip's to
listen on, or use Listen * to make apache listen on all interfaces that are
listed in an "ifconfig"
Listen * # to make it listen on all ip addresses assigned to the
box
Listen 192.168.0.1 # Listen for root web
Listen 192.168.0.2 # Listen for virtual webs
Now that you know that information, lets add a virtual web.
<VirtualHost *>
ServerAdmin root@virtual.com
ServerName virtual.com
DocumentRoot /www/web/virtual.com/public_html
CustomLog logs/virtual.com/access_log combined
ScriptAlias /cgi-bin /www/web/virtual.com/public_html/cgi-bin/
<DIRECTORY /www/web/virtual.com>
AllowOverride All
Options Indexes FollowSymLinks Includes ExecCGI MultiViews
Options All
order allow,deny
allow from all
</DIRECTORY>
<DIRECTORY /www/web/virtual.com/public_html/cgi-bin>
AllowOverride None
Options ExecCGI FollowSymLinks Includes
</DIRECTORY>
LogFormat Combined
ServerAlias nmgi.com *.nmgi.com
</VirtualHost>
First, a few points on this virtual domain definition. <VirtualHost
*>
can be changed to any of the following.
<VirtualHost *> # To make this virtual web listen on all
interfaces and all ports
<VirtualHost 192.168.0.2> # If you have a separate IP # for virtual
hosting
<VirtualHost 192.168.0.2:80> # To listen only on port 80 on
192.168.0.2
<VirtualHost *:80> # To listen only on port 80 on all
interfaces
I just use <VirtualHost *> because I only have 1 IP address allotted
to
my box. This does destroy your root web (/www/httpd) and makes your first
VirtualHost definition your root web.
In the chance that someone goes to your IP # of your box, they will be
served
the first Virtual web, instead of the root web. That's why it is nice
sometime
to have 2 ip addresses on the box, and assign the root web it's own
independant
ip address. Or if you have a whole class 6, or a subnet, then you can
assign
each virtual web it's own ip address which is even nicer.
The <Directory> definitions in the virtual host allow frontpage to
override the permissions using the .htaccess files.
Okay, now that you have a virtual host added to your httpd.conf named
"virtual.com", save your httpd.conf and lets apply a frontpage extension
to it.
# cd /usr/local/frontpage/currentversion/bin
# ./fpsrvadm.exe -o install
: 0 - for apache (do not chooose apache-fp because we have already
patched and
statically compiled)
: /usr/local/httpd/conf/httpd.conf - for your server config file.
: virtual.com - for multi-hosting name.
: 'user' - for the Unix username, enter whatever user you want to own
the
DocumentRoot (i.e. /www/web/virtual.com)
: 'group' - for the Unix group, enter whatever group you want to own the
group
of DocumentRoot (i.e. /www/httpd)
: 'user' - for frontpage login ( usually same as the ftp login for the
virtual web)
: 'password' - password for frontpage login ( usually same as the ftp
login for
the virtual web)
Note for virtual webs, i create a user on the box for each virtual web,
my
user and group in this situation would be.
: virtual ( user for virtual.com)
: web ( i use same group for all websites) user and group must be
valid in
/etc/passwd and /etc/group prior to running ./fpsrvadm.exe to install the
frontpage extensions.
Now frontpage extenstion have been copied over to the DocumentRoot of your
new
virtual web (i.e. /www/virtual.com/public_html). You can change to that
directory and verify you have the _vti_ folders in place.
Now try to connect to your new virtual web through frontpage.
Ex. http://www.virtual.com
It should ask you for login and password that you specified in the
./fpsrvadm.exe setup of virtual.com
If this works, then you are ready to add more Virtual domains to
httpd.conf
and then apply the frontpage extensions using ./fpsrvadm.exe in the same manner!!
12. Only other steps is to test your PHP, CGI, and SSI. You can use the
following files or create your own.