电脑技术学习

配合QMAIL邮件系统:SOLARIS + HTTPD + MYSQL + PHP + LIMITIP

dn001
本人声明如需转载请保留如下信息:

作者: LLZQQ
MAIL: LLZQQ@126.COM
FROM: WWW.CHINAUNIX.NET


一、READY:

首先安装下列工具包,并设置PATH:

perl
ncurse
autoconf
libgcc
automake
make
gcc

二、MySQL-4.0.15:

# groupadd mysql
# useradd -g mysql –s /bin/false mysql

# pkgadd -d ./ -s /var/spool/pkg SFWmysql SFWgcmn
# pkgadd SFWgcmn SFWmysql
# /opt/sfw/mysql/bin/mysql_install_db

# chown -R root /opt/sfw/mysql
# chgrp -R mysql /opt/sfw/mysql
# chown -R mysql /opt/sfw/mysql/var

# cp /opt/sfw/mysql/share/mysql/my-medium.cnf /etc/my.cnf
# vi /etc/my.cnf

bind-address = 127.0.0.1

设置启动脚本:

# cp /opt/sfw/mysql/share/mysql/mysql.server /etc/init.d/mysql.server
# ln /etc/init.d/mysql.server /etc/rc3.d/S79mysql
# ln /etc/init.d/mysql.server /etc/rc0.d/K00mysql
# ln /etc/init.d/mysql.server /etc/rc1.d/K00mysql
# ln /etc/init.d/mysql.server /etc/rc2.d/K00mysql
# ln /etc/init.d/mysql.server /etc/rcS.d/K00mysql
# chown root:sys /etc/init.d/mysql.server /etc/rc3.d/S79mysql
# chmod 0744 /etc/init.d/mysql.server /etc/rc3.d/S79mysql

设置ROOT密码:

# mysqladmin -u root passWord ******

三、HTTPD-2.0.49:

# gzip –d patch-2.5.4-sol8-intel-local.gz
# pkgadd –d patch-2.5.4-sol8-intel-local
# gzip -d httpd-2.0.49.tar.gz
# gzip -d mod_limitipconn-0.22.tar.gz
# tar vxf httpd-2.0.49.tar
# tar vxf mod_limitipconn-0.22.tar
# cd httpd-2.0.49
# ./configure
--prefix=/usr/local/apache
--with-module=aaa:../mod_limitipconn-0.22/mod_limitipconn.c
--with-charset=gb2312
--with-extra-charsets=all
--enable-so
--enable-shared=max
--enable-module=most
--enable-forward
--enable-deflate
--enable-threads
--with-mpm=worker

# make
# make install

建立启动脚本:

# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
# chmod 744 /etc/init.d/httpd
# chown root:sys /etc/init.d/httpd
# ln -s /etc/init.d/httpd /etc/rc3.d/S50http
# ln -s /etc/init.d/httpd /etc/rc3.d/K50http
# ln -s /usr/local/apache/bin/apachectl /bin/apache
# ln -s /usr/local/mysql/bin/mysql /bin/mysql
# vi /usr/local/apache/conf/httpd.conf

配置允许的最大进程数量:

<IfModule worker.c>
StartServers 10
ServerLimit 2000
MaxClIEnts 1500
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

修改添加下列配置项:

DirectoryIndex index.HTML index.html.var index.php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddDefaultCharset GB2312
ExtendedStatus On

为安全起见取消VER显示:

ServerTokens Prod
ServerSignature Off

限制IP进程数设置:

<IfModule mod_limitipconn.c>
<Location / >
MaxConnPerIP 3
</Location>
</IfModule>

限制PHP请求的数据大小:

<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 5640000
</Files>

四、PHP-4.3.6:

# gzip -d php-4.3.6.tar.gz
# tar vxf php-4.3.6.tar
# cd php-4.3.6
# ./configure
--prefix=/usr/local/php
--with-charset=gb2312
--with-mysql
--with-mail
--with-apxs2=/usr/local/apache/bin/apxs
--enable-track-vars
--enable-force-cgi-redirect
--enable-pic
--enable-inline-optimiation
--enable-memory-limit
--enable-bcmath
# make
# make install

# cp php.ini-dist /usr/local/php/lib/php.ini
# vi /usr/local/php/lib/php.ini

register_globals = On
display_errors = Off
memory_limit = 16M
post_max_size = 6M
upload_max_filesize = 6M

五、测试服务器:

# vi /usr/local/apache/htdocs/test.php

<?php phpinfo(); ?>

在浏览器中测试:

http://nero.3322.org/test.php

六、注意事项:

如果要使用QMAIL/SENDMAIL+IGENUS的邮件服务器,要先安装QMAIL/SENDMAIL然后再安装PHP,否则PHP中的“—with mail”将不会生效。

标签: