Installation and configuration of Unix servers (FreeBSD)-Apache full installation (APACHE PhP4 mod_ssl mod_perl mod_fastcgi mod_gzip)
This article mainly discusses the installation of source code.
Download the following programs from the Internet (DSO installation is used in this article) and follow these steps:
1、apache_1.3.27.tar.gz
2、mod_ssl-2.8.12-1.3.27.tar.gz
3366mod_perl-1.0-current.tar
4、mod_gzip-1.3.26.1a.tar.gz
5、mod_fastcgi-2.4.0.tar.gz
6、php-4.3.1.tar.gz
Examples, PNG, gettext, FreeType, JPEG, Gd, and GD2)
Install pth-1.4.1
Pth-1.4.1.tar.gz # tar zxvf
Server # cd pth-1.4.1
Server #./configure -- enable-pthread
Server # Make
Server # Make Test
Server # make install
Install mm-1.1.3
Mm-1.1.3.tar.gz # tar zxvf
Server # cd mm-1.1.3
Server #./configure -- disable-shared
Server # Make
Server # Make Test
Server # make install
Install perl-5.6.1
Perl-5.6.1.tar.gz # tar zxvf
Server # cd perl-5.6.1
Server # sh configure-de
Server # Make
Server # Make Test
Server # make install
Install zlib-1.1.4
Zlib-1.1.4.tar.gz # tar zxvf
Server # cd zlib-1.1.4
Server #./configure
Server # Make Test
Server # make install
Install libpng-1.2.5 (need zlib-1.1.4, PNG)
Server # pkg_add PNG-version
Libpng-1.2.5.tar.gz # tar zxvf
Server # cd libpng-1.2.5
Server # cp scripts/makefile. FreeBSD makefile
Server # Make
Server # Make Test
Server # make install
Install the apache_1.3.27 mod_ssl-2.8.12-1.3.27 (need OpenSSL, mm, prel_5.6.0) mod_perl-1.0-current
1. decompress the package (the following files are decompressed in the same directory)
Server # tar zxvf apache_1.3.27.tar.gz
Mod_ssl-2.8.12-1.3.27.tar.gz # tar zxvf
Mod_perl-1.0-current.tar # tar zxvf
2. Configure mod_ssl-2.8.12-1.3.27
Server # cd mod_ssl-2.8.12-1.3.27
Server #./configure -- With-Apache = ../apache_1.3.27/
-- With-Mm = ../mm-1.1.3/
-- Prefix =/usr/local/Apache/
-- Enable-shared = SSL
Server # CD ..
3. Configure the installation mod_perl-1.27
Server # cd mod_perl-1.27
Server # Perl makefile. pl everything = 1 apache_src = ../apache_1.3.27/src use_apaci = 1 prep_httpd = 1 do_httpd = 1 (there are two error messages in FreeBSD 4.7, ignore)
Server # Make
Server # make install
Server # CD ..
4. Configure and install apache_1.3.27
Server # cd apache_1.3.27
Server #./configure -- prefix =/usr/local/Apache/
-- Enable-module = SSL/
-- Activate-module = src/modules/perl/libperl./
-- Enable-module = most/
-- Enable-shared = max
Server # Make
Server # Make certificate (generate a certificate, select as prompted, and write down the password)
Server # make install
Install mod_gzip-1.3.26
Mod_gzip-1.3.26.1a.tar.gz # tar zxvf
Server # cd mod_gzip-1.3.26.1a
Server # edit makefile (set the apxs path to apxs? =/Usr/local/sbin/apxs change to Apache installation path: apxs? =/Usr/local/Apache/bin/apxs)
Server # Make
Server # make install
Install mod_fastcgi-2.4.0
Mod_fastcgi-2.4.0.tar.gz # tar zxvf
Server # cd mod_fastcgi-2.4.0
Server #/usr/local/Apache/bin/apxs-O mod_fastcgi.so-C *. c
Server #/usr/local/Apache/bin/apxs-I-a-n FastCGI mod_fastcgi.so
Install the php-4.3.1 (need gettext, FreeType, JPEG, Gd, GD2, PNG, assuming MySQL is already installed and running)
Server # pkg_add gettest-version
Server # pkg_add JPEG-version
Server # pkg_add Gd-version
Gd2-version # pkg_add
Php-4.3.1.tar.gz # tar zxvf
Server # cd php-4.3.1
Server #./configure -- With-apxs =/usr/local/Apache/bin/apxs/
-- With-config-file-Path =/usr/local/Apache/CONF/
-- With-mysql =/usr/local/MySQL -- With-mysql-Sock =/tmp/-- enable-versioning/
-- Enable-FTP -- enable-bcmath -- disable-Debug -- enable-memory-Limit = Yes/
-- Enable-track-vars -- enable-sysvsem -- enable-sysvshm -- With-gettext/
-- Enable-trans-Sid -- enable-FastCGI -- With-tsrm-PTH = PTH-config/
-- With-FreeType-Dir =/usr/local -- With-JPEG-Dir =/usr/local -- With-Gd =/usr/local/
-- Enable-Gd-native-TTF -- With-PNG-Dir =/usr/local -- With-zlib =/usr/local/
-- With-zlib-Dir =/usr/local -- With-Mm =/usr/local -- With-OpenSSL -- With-iconv
Server # Make
Server # make install
Server # cp PHP. ini-Dist/usr/local/Apache/CONF/PHP. ini
Configure Apache to support PHP and PHP. ini files:
There are two files in/use/local/Apache/conf:
1. Example of/usr/local/Apache/CONF/httpd. conf: httpd. conf
2. Example of/usr/local/Apache/CONF/PHP. ini: php. ini
Add the following in httpd. conf:
Addtype application/X-httpd-PHP. php. php3
Addtype application/X-httpd-PHP-source. PHPs
Configure PHP. ini:
Upload_tmp_dir/tmp
Default_charset gb2312
Register_globals on
After the installation is complete, run the following command to start Apache:
Server #/usr/local/Apache/bin/apachectl start
To Use https, run the following command:
Server #/usr/local/Apache/bin/apachectl startssl
(Enter the certificate password and press Enter)
Compile the Apache self-starting file (under FreeBSD ):
Server # edit/usr/local/etc/rc. d/apache-server.sh example: apache-server.sh
Server # chmod 755 apache-server.sh
Restart the server and bind9 will run automatically!
Test Server:
Edit test. php under/usr/local/Apache/htdocs to test whether PHP is successfully installed. Example: Test. php
Enter http://www.nankai.edu.cn/test.php in the address bar of the browser to display the PHP installation information.
If you are using the apachects startssl command to start, you can
Enter https://www.nankai.edu.cn/test.php in the address bar of the browser to display the PHP installation information.
Virtual Server Settings (from Apache server in the environmental programming field virtual web Author: Unknown) original, not modified:
I. IP-type VM
An IP host is the unique IP address of each VM. Multiple IP addresses can be implemented through multiple physical NICs or virtual network interfaces. Both solaris2.5 and Windows NT support this method.
You can configure multiple VM instances in either of the following ways:
1. Start an httpd process for each VM.
Use this method in the following cases:
1) Security Isolation needs to be considered. For example, two httpd instances run on different users, groups, listen, and serverroot instances. In addition to browsing data through the Web, the two users cannot access other data.
2) provides sufficient memory and file descriptors.
Setting method:
Create an independent httpd installation for each virtual host. In the configuration file httpd. conf of each installation path, use the listen command to specify the IP address of the process service, for example, listen 10.68.37.10: 80.
2. Start an httpd process for all virtual hosts.
Use this method in the following cases:
1) allows sharing httpd configurations between virtual hosts.
2) computers serve a large number of requests and run multiple processes to reduce server performance.
Setting method:
In the configuration file httpd. conf, use the virtualhost command to set serveradmin, servername, DocumentRoot, errorlog, transferlog, or customlog for each virtual host, for example:
# IP addresses are recommended here
Serveradmin webmaster@mail.smallco.com
DocumentRoot/usr/local/etc/httpd/htdocs/smallco
Servername www.smallco.com # we recommend that you use a domain name here
Errorlog/usr/local/etc/httpd/logs/smallco/error_log
Transferlog/usr/local/etc/httpd/logs/smallco/access_log
# IP addresses are recommended here
Serveradmin webmaster@mail.baygroup.org
DocumentRoot/groups/baygroup/WWW
Servername www.baygroup.org # domain names are recommended here
Errorlog/groups/baygroup/logs/error_log
Transferlog/groups/baygroup/logs/access_log
At the same time, you need to configure the virtual network port or network card, and configure the corresponding settings in DNS.
Ii. Name-based VM (supported by apache1.3 and later versions)
Although the IP type VM is good, it is not the best solution. It requires each VM to have a dedicated IP address, which is difficult to implement on some machines. A name-based VM is a virtual host.