Linux + Apache + MySQL + PHP + FrontPage Installation

Source: Internet
Author: User
Tags ftp login stop script
Linux + Apache + MySQL + PHP + FrontPage installation-Linux Enterprise Application-Linux server application information. For details, refer to the following section. This article describes how to install Apache to support MySQL, PHP4, and FrontPage2000 Server Extensions and virtual host functions. The installation steps in this article are tested on Redhat 7.0 and Mandrake 7.2, so they should be applicable to any Linux release, it also applies to * nix systems in any form, as long as different software packages are downloaded.
I. Requirements
1. an Intel-based Linux system with TCP/IP and libc6 installed. If Apache or MySQL has been installed, we recommend that you use the software package manager or manually delete them.
2. software packages to be installed, including: Apache 1.3.19, MySQL server, PHP4 and FrontPage 2000 extensions, Apache support for FrontPage 2000 extensions, the latest gcc compiler and related libraries.
2. Prepare for Installation
1. download the software package
Download the following software package to the/download directory.
Apache 1.3.19
MySQL Server
PHP4
FrontPage 2000 Extensions
2. decompress the source code
Decompress the source code packages under all/download directories (except for the frontpage to be decompressed to the/use/local directory:
Tar zxfv apache_1.3.19.tar.gz
Tar zxfv fp40.linux.tar.gz-C/usr/local
Tar mysql-3.23.32.tar.gz
Tar zxfv php-4.0.4pl1.tar.gz.
Iii. Install MySQL
The first step is to install MySQL first, because you need to install PHP that supports MySQL, and then install Apache that supports PHP. The following are the specific steps.
1. Set users and groups
First, the system adds the support and group named mysql.
Groupadd mysql
Useradd-g mysql
2. Configure and build MySQL
Go to the directory/download/mysql-3.23.32 and run the configure and make programs. If you want to store the database in a non-default directory/usr/local/mysql/var/, set localstatedir =/your_path for configure.
Cd mysql-3.23.32
./Configure -- prefix =/usr/local/mysql
Make
Make install
MySQL has been installed in the/usr/local/mysql directory. Currently, there is no data directory. Now you need to run the MySQL script to create a directory and install the test database. Scripts/mysql_install_db changes the File Ownership before starting the daemon. Otherwise, the daemon cannot run.
Chown-R mysql. mysql/usr/local/mysql
3. Start the MySQL daemon
Start the daemon. Safe_mysqld is equivalent to tcpwrapper for MySQL. tcpwrapper is often used to package inet services to increase installation.
/Usr/local/mysql/bin/safe_mysqld -- user = mysql &
4. Set the root user password and start MySQL during boot.
MySQL is currently running. You can use mysqladmin to set the root user password.
/Usr/local/mysql/bin/mysqladmin-u root-p password 'yourpass'
The last step is to ensure that MySQL can be started when the system restarts. Edit the/etc/rc/d/rc. local file and add/usr/local/mysql/bin/safe_mysqld -- user = mysql & to the end &. Alternatively, you can write a start/stop script with a symbolic link to the appropriate running level.
4. Patch Apache
Before proceeding to the following steps, we must patch Apache with FrontPage, copy the FrontPage patch to the Apache source code directory, and create a symbolic link to the currentversion of FrontPage.
Cd/usr/local/frontpage/
Ln-s version4.0 currentversion
Cd currentversion/apache-fp
Cp fp-patch-apache_1.3.12/downloads/apache_1.3.19
1. Patch
Now, add the FrontPage patch under the Apache source code directory. This will require the binary patch to be placed under your directory.
Patch-p0 <fp-patch-apache_1.3.12
This will generate a mod_frontpage.c file under the apache source code Directory, which needs to be copied to the extras module.
Cp fp-patch-apache_1.3.12 src/modules/extra/
2. Run a simple apache configuration
Now run a simple configuration, and then run more advanced configuration.
/Downloads/apache_1.3.19/configure
5. Install PHP4
PHP4 is a server-side, cross-platform, and HTML embedded scripting language. It gives us the ability to develop dynamic websites and can easily interface with MySQL servers.
1. Configure PHP4 to support MySQL and Apache
You will install PHP4 that supports mysql in the/usr/local/MySQL directory.
Cd/downloads/php-4.0.4pl1
./Configure -- with-mysql =/usr/local/mysql -- with-apache =/downloads/apache_1.3.19 -- enable-track-vars
2. Configure apache to support MySQL and Apache
Run make and make install to compile the files required by Apache.
Make
Make install
6. Install the Apache server
Apache is the core of this article, so install the following steps carefully. Now PHP has been built. You will find a new directory under the Apache source code directory ../apache_1.3.19/src/modules/php4. Now we configure apache again, but the support for PHP and FrontPage has been built statically.
1. Create a symbolic link and directory structure
Create a symbolic link/usr/local/httpd pointing to/usr/local/apache-1.3.x so that you can build a new version of apache and then relink as necessary. Run the following command:
Mkdir/usr/local/apache-1.3.19.
Ln-s/usr/local/apache-1.3.19/usr/local/httpd
2. Configure Apache to support ForntPage and PHP4
Now we can use -- prefix =/usr/local/httpd to configure apache, which is a symbolic link pointing to apache-1.3.19. You know, src/modules/php4/libphp4.a does not exist, but will be generated. Note that you can use -- add-module to add FrontPage and -- activate-module to add PHP. Run make and make install to build and install Apache. It doesn't matter where httpd. conf is put. Some people prefer to put it in the/etc directory. If you do this, add -- localstatedir =/etc.
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
3. Construct Apache
Run make to create the httpd binary code. If you overwrite an old version of server, all you need to do is make, and then you can know the httpd binary code from the bin directory to the existing httpd product directory. We recommend that you have a new installation, because it is very easy to migrate www Data and conf files from the original installation.
Make
Make install
7. Modify httpd. conf
Good. You have installed Apache and supported FrontPage, PHP, and MySQL. Now let's sort out other things so that they can work better. First, modify some httpd. conf configurations.
1. Add a PHP flag
To allow Apache to process the PHP extension, you must add this type. Make sure that you comment out the following two lines in the configuration file. If the two rows do not exist, you must manually add them.
AddType application/x-httpd-php. php
AddType application/x-httpd-php-source. phps
2. Change Directory Index
Change Directory indexsupport to increase index.php and index.shtml. This serves as a reference, but if your website is strictly written in SSI or PHP, these additional Directory Index files will avoid referring to the full path of the index file. On the contrary, you can simply type the http://www.virtual.com instead of http://www.virtual.com/index.php.
DirectoryIndex index. php index.shtml index.html index.htm
3. modify directory permissions
Several important modifications to the configuration file are the DocumentRoot and Directory permissions. Modify DocumentRoot to point to your default webpage file, as shown in figure
DocumentRoot/www/httpd
Now you can modify the directory permission for it. The FrontPage can overwrite them with its. htaccess file. Change AllowOverride from None to All.
<Directory "/www/httpd">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow, deny
Allow from all
</Directory>
8. Use FrontPage Extensions to access the root website
We have completed Apache that supports PHP and MySQL, and the rest is the FrontPage Server Extension. You may or may not use it for your website. However, if you have many users who need to edit the website and not everyone is familiar with FTP and HTML, it will be useful.
1. Run fpsrvadm.exe
We use the FrontPage extension for the website root directory (/www/httpd ).
Cd/usr/local/frontpage/currentversion/bin/
Run fpsrvadm.exe to install and extend to the root directory. ./Fpsrvadm.exe-o install
: 0 for apache (do not choose apache-fp)
:/Usr/local/httpd/conf/httpd. conf (patch to server config file)
: ENTER (Just hit enter for a blank multi-hosting)
: Apache (user owner of DocumentRoot (I. e./www/httpd ))
: Web (group owner of DocumentRoot (I. e./www/httpd ))
: Myuser (frontpage login)
: Mypass (frontpage password)
Note that "apache" and "web" groups are used here. For virtual domains, users are separated for each virtual domain, but the group is always "web ".
2. Create other FrontPage users
Now you can simply provide an administrator account and password for FrontPage. It will be the login name and password for accessing FrontPage. It may be better if you keep these data synchronized with ftp login. You can always come back and run./fpsrvadm.exe and Use Option 7 to add a user and enter the correct information. Alternatively, you can modify the/_ vti_pvt/service. pwd file containing the user and encrypted password. to generate an encrypted password, use:
Htpasswd temp. pass. file
Enter Password :**********
Pico temp. pass. file
<My-new-user>: 3923kw # $ sdfk32 $
Then copy the user and encrypted password to the service. pwd and the user can log on. You must also package the user group into a group so that you can modify the website by editing/_ vti_pvt/service. grp complete.
Pico _ vti_pvt/service. grp
Administrators: administrator <my-new-user>
Authors:
Add new users to the appropriate website group. Now, try to log on Via FrontPage. After adding "author" or "administrator", you should have the right to edit it.
9. Using FrontPage to create a virtual website
This process is the same as adding users to the root website. The only difference is that when fpsrvadm.exe is run, a muulti-hosting name should be provided instead of a carriage return. The multi-host name is the ServerName defined in <VirtualHost>.
First, edit htppd. conf and remove the comments of the NameVirtualHost line. If you only have one IP address on this machine, the first virtual host in the table will be your root website. If there are two IP addresses, your root website may be at 192.168.0.1 and the virtual website may be at 192.168.0.2, which can keep the root website intact.
If you have 1 ip address
NameVirtualHost *
If you have a separate ip address just for your virtual webs
NameVirtualHost 192.168.0.2
Make sure that if you have multiple IP addresses, tell Apache which IP address to Listen to, or use Listen * To let Apache Listen to all interfaces listed in ifconfig.
# To make apache listen on all ip addresses assigned to the box
Listen *
# Listen for root web
Listen 192.168.0.1
# Listen for virtual webs
Listen 192.168.0.2
Now you know this information, for example, a virtual website.
<VirtualHost *>
ServerAdmin root@virtual.com
ServerName virtual.com
DocumentRoot/www/virtual.com/public_html
CustomLog logs/virtual.com/access_log combined
ScriptAlias/cgi-bin/www/virtual.com/public_html/cgi-bin/
<DIRECTORY/www/virtual.com>
AllowOverride All
Options Indexes FollowSymLinks Includes ExecCGI MultiViews
Options All
Order allow, deny
Allow from all
</DIRECTORY>
<DIRECTORY/www/virtual.com/public_html/cgi-bin>
AllowOverride None
Options ExecCGI FollowSymLinks between des
</DIRECTORY>
LogFormat Combined
ServerAlias virtual.com * .virtual.com
</VirtualHost>
First, there are several descriptions in this virtual domain definition. <VirtualHost *> can be changed to any of the following.
# To make this virtual web listen on all interfaces and all ports <VirtualHost *>
# If you have a separate IP # for virtual hosting <VirtualHost 192.168.0.2>
# To listen only on port 80 on 192.168.0.2
<VirtualHost 192.168.0.2: 80>
# To listen only on port 80 on all interfaces
<VirtualHost *: 80>
Only <VirtualHost *> is used here, because there is only one IP address on the machine. Remember, this does destroy your root website (/www/httpd) and make the first <VirtualHost> definition your root website.
When someone reaches your IP address, they are first served by the first virtual website instead of the root website. This is why the machine has two IP addresses and the root website is placed in their own independent IP addresses. Or if you have an entire class C address or a subnet, you can assign each website its own IP address, which is better.
The <Directory> definition in the VM allows FrontPage to use the. htaccess file to override the permission.
Now you have added a virtual host to httpd. conf named "virtual.com", saved httpd. conf, and used the FrontPage extension.
Cd/usr/local/frontpage/currentversion/bin
./Fpsrvadm.exe-o install
: 0 for apache (do not choose apache-fp)
:/Usr/local/httpd/conf/httpd. conf (patch to server config file.
: Www.virtual.com (the name of ServerName in <VirtualHost>)
: Apache (user owner of DocumentRoot (I. e./www/httpd ))
: Web (group owner of DocumentRoot (I. e./www/httpd ))
: Myuser (frontpage login)
: Mypass (frontpage password)
Note: For a virtual website, create a user for each website on the machine. In this example, users and groups are:
: Virtual (virtual.com user)
: Web (user groups for all websites)
Users and groups must be valid in/etc/passwd and/etc/group before running./fpsrvadm.exe to install FrontPage extensions. Now the FrontPage extension has been copied to the DocumentRoot (for example,/www/virtual/public_html) of your new virtual website ).
You can change the Directory and verify that there is another _ vti _ folder.
Now try connecting to the new virtual website, Open Web-> http://www.virtual.com through FrontPage.
It should ask for the login name and password. If there is no problem, you can add more virtual hosts to httpd. conf and implement FrontPage extension in the same way.
10. test files
The final steps are to test PHP, CGI, and SSI. You can use the following files or create your own. Upload files to the website through FTP, and then click the browser to test them.
I. PHP test file: test. php
----------------------------------------
<Html>
<Head>
<Title> PHP Test </title>
</Head>
<Body>
<? Php echo "Hello World <P>" ;?>
</Body> Ii. CGI test file: test. cgi (ensure that at least chmod 755 is used)
----------------------------------------
#! /Usr/bin/perl
Print "Content-type: text/html \ n ";
Print"
<Html>
<Head>
<Title> Perl Test </title>
</Head>
<Body>
HEllo World
</Body> ";
Exit (0 );
----------------------------------------
Iii. SSI test file: test.shtml
----------------------------------------
<Html>
<Head>
<Title> SSI Test </title>
</Head>
<Body>
<! -- # Include virtual = "test.txt">
</Body> ----------------------------------------
File: test.txt (used in SSI parsing in test.shtml file above)
----------------------------------------
Hello World
----------------------------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.