欢迎光临
我们一直在努力

打造LAPM超级服务器

序言
说到这篇文档,其实早就要写了,只是一直懒得动,最近因为要配置网站的FTP服务器,正好有两台机器的没有环境,必须从最基本的Apache开始搭起,所以也就趁这个机会把文档写出来了,没想到写起来也蛮快的,因为系统环境已经搭建过无数次,所以在配置完服务器,用了不到2个小时的时间就把文档写完了,呵呵,既然有了第一次,相信还会有第二次、第三次、我会逐渐把我在工作中的事情慢慢写出来,也是自己做一个记录,也希望能对朋友们有所帮助吧。

所谓的LAPM其实就是Linux+Apache+PHP+Mysql的简写,实际上仅有这些是不够的,俗话说计划不如变化快,一点也没错,不过这里暂且叫他LAPM吧。

既然是网站,除了基本的环境之外,上传下载自然是免不了的,在综合比较之后,决定采用pureftpd+mysql+pureftp_manager来搭建.

Pureftpd支持基于系统账号、Mysql、Postgresql、Ldap、PureDB(没用过)的身份验证,并且通过Pureftp_manager可以实现用户上传/下载流量控制,用户空间限制,上传/下载比率设置,其他更高级的功能暂时没用,实在是太懒,不过如果须要,看看官方文档,配置起来也很容易的

不多说了,开始干活了,以下安装全部为tar包安装.

第一部分 安装

Linux操作系统,这个不用说了,本文档用的是RedHat AS 4
[v_blue]Mysql-4.1.21.tar.gz
PHP-4.4.3.tar.gz
Pure-ftpd-1.0.21.tar.gz
ftp_v2.1.tar.gz
Httpd-2.2.3.tar.gz
zlib-1.2.2.tar.gz
libpng-1.2.8.tar.gz
Freetype-2.1.8.tar.gz
Jpeg.src.v6b.tar.gz
libxml2-2.6.26.tar.gz
ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
gd-2.0.26gif.tar.gz
mod_limitipconn-0.22.tar.gz
phpMyAdmin-2.8.2.2.tar.gz[/v_blue]
将以上软件全部下载到/usr/local/src目录,我们所有的操作都将在这个目录执行。
一、安装httpd

tar zxvf Httpd-2.2.3.tar.gz
cd /httpd-2.2.3
./configure --prefix=/usr/local/apache
--enable-authn-alias
--enable-cache
--enable-file-cache
--enable-mem-cache
--enable-disk-cache
--enable-ssl
--enable-dav
--enable-cgi
--enable-cgid
--enable-vhost-alias
--enable-rewrite
--enable-so
--with-mpm=worker
make;make install
vi /etc/rc.d/rc.local
/usr/local/apache/bin/apachectl start

二、安装Mysql

在系统中增加一项新的服务,尽量不要以root账号来执行,所以在此,我们增加一个mysql和mysql组来管理mysql服务器

添加mysql用户和mysql组

groupadd mysql
useradd mysql –g mysql –s /sbin/nologin –d /dev/null
tar zxvf Mysql-4.1.21.tar.gz
cd Mysql-4.1.21
./configure --prefix=/usr/local/mysql
--with-unix-socket-path=/tmp/mysql.sock
--with-mysqld-user=mysql
--with-charset=gb2312
--with-extra-charsets=all
make;make install
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
chkconfig –level 23456 mysql on
vi /etc/my.cnf
#增加三行配置
bind-address=127.0.0.1 #指定只有本机可以访问mysql服务器
max_connections=200 #将mysql的最大连接数修改为200
log=/var/log/mysql.log #打开mysql的日志
Ln –s /usr/local/mysql/lib/mysql/* /usr/lib/
Ln –s /usr/local/mysql/include/mysql/* /usr/include #这两步比较重要,在安装pureftpd的时候经常会提示mysql客户端或者客户端库文件没有安装,所以把这两个文件夹的文件链接到/usr/lib和/usr/include目录里去,
PATH=$PATH:/usr/local/mysql/bin
Export PATH
#以上两步在系统路径中增加mysql的系统文件路径,并使之生效.
mysql_install_db   #初始化mysql
/etc/init.d/mysql start

三、安装pure-ftpd

tar zxvf pure-ftpd-1.0.21.tar.gz
cd / pure-ftpd-1.0.21
./configure --prefix=/usr/local/pureftpd
--with-cookie
--with-throttling
--with-ratios
--with-quotas
--with-ftpwho
--with-welcomemsg
--with-largefile
--with-virtualhosts
--with-virtualchroot
--with-language=simplified-chinese
--with-mysql
--with-tls
make;make install
mkdir /usr/local/pureftpd/etc
cp pureftpd-mysql.conf /usr/local/pureftpd/etc
cp configuration-file/pure-ftpd.conf /usr/local/pureftpd/etc
cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin
cd /usr/local/pureftpd/sbin/
vi pureftpd.start
/usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf
chmod 755 *
vi /etc/rc.d/rc.local
/usr/local/pureftpd/sbin/pureftpd.start
#--with-cookie 使用者进站看到的东东.类似进站画面.
#--with-throttling 带宽设置
#--with-quotas 使用配额(非系统配额)
#--with-ftpwho 使用者管理
#--with-welcomemsg 打开欢迎信息
#--with-largefile 支持大文件传输
#--with-virtualhosts 类似apache中的虚拟主机
#--with-virtualchroot 可以对目录中的链接做chroot动作
#--with-language=simplified-chinese 设置系统语言为简体中文
#--with-mysql 支持mysql
#--with-tls 打开SSL/TLS支持

[v_error]注:为了方便管理,我们将php及其相关的插件全部安装在/usr/local/phptool目录。[/v_error]

四、安装php及其插件安装zlib

tar zxvf zlib-1.2.2.tar.gz
cd zlib-1.2.2
./configure –prefix=/usr/local/phptool/zlib
make;make install

安装libpng-1.2.8.tar.gz tar zxvf linbpng-1.2.8.tar.gz

cd linbpng-1.2.8
cp scripts/makefile.linux make
vi make
#将prefix=/usr/local修改为prefix=/usr/local/phptool/libpng
make;make install

安装jpegsrc.v6b.tar.gz

tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure –prefix=/usr/local/phptool/jpeg
make;make install

#在编译jpeg的时候通常会报无法创建某目录的错误,只要按照提示创建相关目录,然后重新make;make install即可。

安装libxml2-2.6.26.tar.gz

tar zxvf libxml2-2.6.26.tar.gz
cd libxml2-2.6.26
./configure –prefix=/usr/local/phptool/libxml
make;make install

安装freetype-2.1.8.tar.gz

tar zxvf freetype-2.1.8
cd freetype-2.1.8
./configure –prefix=/usr/local/phptool/freetype
make;make install

安装gd-2.0.26gif.tar.gz

tar zxvf gd-2.0.26gif.tar.gz
cd gd-2.0.26gif
./configure --prefix=/usr/local/phptool/gd
--with-png=/usr/local/phptool/libpng/
--with-freetype=/usr/local/phptool/freetype
--with-jpeg=/usr/local/phptool/jpeg
--with-xmp=/usr/local/phptool/libxml/include/libxml2/libxml/
--with-zlib=/usr/local/phptool/zlib/
#以上是告诉GD,png,freetype,jpeg,libxml,zlib的安装路径
make; make install

安装PHP

tar zxvf PHP-4.4.3.tar.gz
cd PHP-4.4.3
./configure --prefix=/usr/local/phptool/php
--with-apxs2=/usr/local/apache2/bin/apxs
--with-jpeg-dir=/usr/local/phptool/jpeg6/
--with-png-dir=/usr/local/phptool/libpng2/
--with-gd=/usr/local/phptool/gd2/
--with-freetype-dir=/usr/local/phptool/freetype2/
--enable-ftp
--with-zlib-dir=/usr/local/zlib2/
-with-mysql=/var/lib/mysql
make;make install
cp php.ini-dist /etc/php.ini

安装ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz

tar zxvf ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.0.1-linux-glibc21-i386
./install

在出现的配置界面中,需要选择Zend的安装路径,apache可执行程序httpd或者apachectl的路径,以及php.ini的路径,所有这些配置
完成后,会提示重启apache,确认重启即可。

安装mod_limitipconn-0.22.tar.gz
tar zxvf mod_limitipconn-0.22.tar.gz
cd mod_limitipconn-0.22.
/usr/local/apache/bin/apxs -c -i -a mod_limitipconn.c

至此,Apache+PHP+pure_manager+Mysql+GD2+mod_limitipconn的安装到此结束,剩下的就是配置虚拟主机及Pure_Manager了。

首先,我们来配置apache及其虚拟主机,打开/usr/local/apache/conf/httpd.conf

# # This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See for detailed information.
# In particular, see
#
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
# with ServerRoot set to "/usr/local/apache" will be interpreted by the
# server as "/usr/local/apache/logs/foo.log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/usr/local/apache"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
LoadModule limitipconn_module modules/mod_limitipconn.so
LoadModule php4_module modules/libphp4.so
#
ExtendedStatus On

#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# user/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
user nobody #为安全期间,将Apache的执行者改为nobody
Group nobody

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# definition. These values also provide defaults for
# any containers you may define later in the file.
#
# All of these directives may appear inside containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
ServerName 127.0.0.1:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/usr/local/apache/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#

Options FollowSymLinks
AllowOverride None
Order deny,allow
allow from all

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI Multiviews
#
# Note that "Multiviews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#

DirectoryIndex index.html index.htm index.php

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#

Order allow,deny
Deny from all
Satisfy All

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a
# container, that host's errors will be logged there and not here.
#
ErrorLog logs/error_log
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{user-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common

# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{user-Agent}i" %I %O" combinedio

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a
# container, they will be logged here. Contrariwise, if you *do*
# define per- access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog logs/access_log common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog logs/access_log combined

#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
# ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"

# # ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock

#
# "/usr/local/apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#

AllowOverride None
Options None
Order allow,deny
Allow from all

#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php .phtml
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf  #关于MPM设置,建议参考官方文档,以自己站点实际来设置。
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# user home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf
# virtual hosts
#Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#

SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

NamevirtualHost 192.168.1.18
Include /usr/local/apache/conf/Include/*.conf

#为规范期间,我们将apache的虚拟主机配置文件单独存放,位置为/usr/local/apache/confi/Include,更多Apche设置请参考官方文档根据自己站点来设置,本文档只开默认功能。

首先在根目录下建立一个/www目录来放置所有的站点,并在此目录建立

[v_act]“/www/ftpmanager. example.com/www/htdocs/”
“/www/ftpmanager.example.com/www/htdocs/”
“/www/phpmyadmin.example.com/www/htdocs/”
“/www/phpmyadmin.example.com/www/logs”四个目录。[/v_act]

十四、 生成虚拟主机配置文件
在”/usr/local/apache/con/Include”目录里定义两个虚拟主机, phpmyadmin.example.com.conf
ftpmanager.example.com.conf,配置内容如下:
配置Phpmyadmin.example.com.conf

<Directory "/www/phpmyadmin.example.com/www/htdocs/">
Options Indexes Multiviews #使用apache验证对phpmyadmin进行保护
AllowOverride AuthConfig
Options All
Order allow,deny
Allow from all
</Directory>
<virtualHost 192.168.1.18>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /www/phpmyadmin.example.com/www/htdocs/
ServerName phpmyadmin.example.com
<IfModule mod_limitipconn.c>
<Location /down>
MaxConnPerIP 2 # 每IP只允许2个并发连接
NoIPLimit image/* # 对图片不做IP限制
</Location>
</IfModule>
ErrorLog /www/phpmyadmin.example.com/www /logs/error_log
CustomLog /www/phpmyadmin.example.com/www/logs/acces
s_log common
</virtualHost>
#以上mod_limitipconn的配置只是一个范例,具体设置根据自己的情况来配置
#在“/www/phpmyadmin.example.com/www/htdocs/”目录增加一个.htaccess的文件增加以下内容:
AuthName "PHPMyAdmin Dir" #内容自己定义
AuthType Basic
AuthuserFile /usr/local/apache/conf/htpasswd/.htpasswd #设置一个密码文件
require user phpmyadmin (require valid-user 允许验证列表中所有用户,在此我们指定phpmyadmin用户可以访问该目录)
#/usr/local/apache/bin/htpasswd –a /usr/local/apache/conf/htpasswd/.htpasswd phpmyadmin
#输入两次密码就好了。
配置ftpmanager. example.com.conf
<Directory "/www/ftpmanager. example.com/www/htdocs/">
Options Indexes Multiviews #使用apache验证对pure?ftpd_manager进行保护
AllowOverride AuthConfig
Options All
Order allow,deny
Allow from all
</Directory>
<virtualHost 192.168.1.18>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /www/ftpmanager. example.com/www/htdocs/
ServerName ftpmanager. example.com
<IfModule mod_limitipconn.c>
<Location /down>
MaxConnPerIP 2 # 每IP只允许2个并发连接
NoIPLimit image/* # 对图片不做IP限制
</Location>
</IfModule>
ErrorLog /www/ ftpmanager. example.com/www /logs/error_log
CustomLog /www/ ftpmanager. example.com/www/logs/access_log common
</virtualHost>#在“/www/ftpmanager.example.com/www/htdocs/”目录增加一个.htaccess的文件增加以下内容:
AuthName " ftpmanager Dir" #内容自己定义
AuthType Basic
AuthuserFile /usr/local/apache/conf/htpasswd/.htpasswd #设置一个密码文件
require user ftpmanager
#/usr/local/apache/bin/htpasswd /usr/local/apache/conf/htpasswd/.htpasswd ftpmanager
#输入两次密码就好了

安装配置phpMyadmin

cd /usr/local/src/

tar zxvf phpMyAdmin-2.8.2.2.tar.gz

mv phpMyAdmin-2.8.2.2/* /www/phpmyadmin.example.com/www/htdocs/

cd /www/phpmyadmin.example.com/www/htdocs/

cp libraries/config.default.php config.inc.php

vi config.inc.php

#修改 $cfg['PmaAbsoluteUri'] = 'http://phpmyadmin.example.com';

$cfg['blowfish_secret'] = '123123434';

$cfg['Servers'][$i]['host'] = 'localhost';

$cfg['Servers'][$i]['port'] = ' 3306';

$cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';

$cfg['Servers'][$i]['auth_type']= 'cookie';

其中第一行是添加phpmyadmin的url地址,blowfish_secret是针对“auth_type”设置的一个密钥(我的理解)随便填一个就可以了。

在浏览器里输入http://phpmyadmin.example.com,将会弹出一个验证框,但是你必须保证在此之前已经将apache重启,并且dns已经正确指向虚拟主机所在的ip,且dns已经生效;在验证框里输入刚才建立phpmyadmin和密码就可以正常登陆并管理mysql服务器了。Mysql安装好后默认是没有密码的,正式使用之前记得给mysql增加一个root密码.

安装配置ftp_manager

cd /usr/local/src/

tar zxvf ftp_v2.1.tar.gz

cd ftp

mv * /www/ftpmanager.example.com/www/htdocs/

用phpmyadmin建立一个名称为ftp的数据库,将extra目录里的script.mysql导入ftp数据库,默认的administrator密码为tmppasswd,如果不想使用这个密码,请在导入之前修改相应的字段.导入成功后,修改根目录下的config.php,填入你的mysql数据库名,该数据库的用户名和密码以及你的ftp地址/端口/和默认的虚拟ftp用户id和组,为安全期间,默认用户和组一般都用nobody.

在浏览器里输入http://ftpmanager.example.com,在弹出的验证框输入用户名和密码,就会看到pure_ftp_manager的管理界面,输入administrator的密码,就可以登陆了.但是现在还不能使用ftp,因为还没有配置ftp的服务器.呵呵,现在来最后一步,配置ftp

配置PURE-FTPD

vi /usr/local/pureftpd/etc/pure-ftpd.conf

NoAnonymousyes

MySQLConfigFile    /usr/local/pureftpd/etc/pureftpd-mysql.conf

Bind                        ,21    #将21端口绑定本机所有的ip上

MinUID                     99    #由于我给ftp的虚拟用户定义的是nobody,所以这里用99

MaxDiskusage         99
vi /usr/local/pureftpd/etc/pureftpd-mysql.conf

填入你的mysql相关信息.由于pure_ftp_manager使用的是md5加密,所以这里也应该修改为md5即: MYSQLCrypt cleartext 改为 MYSQLCrypt MD5,后面的选项视你的需要选择打开,或者也可以全部打开.看你自己.需要说明的是ftp的设置都是按照最基本的设置来配置.如果你需要更加高级的功能,请参照官方文档来修改.

最后一步,启动pure-ftpd:/usr/local/pureftpd/sbin/pureftpd.start
备注:因考虑到目前大多数PHP程序都是基于php4开发,为求稳定,本文档采用的php版本为php-4.4.3而非php5,本文档所有的步骤在RedHat AS4和RedHat AS3以及Fedora上测试通过,但因环境不同可能会略有出入,请大家参照执行.

其实最初只是为了建立一个Pure-ftpd,不过后来随着需要的插件的增加,所以也就有了本文现在的样子,其实到了这里,如果你有兴趣,完全可以用这台服务器来做虚拟主机或者个人站点之类的,呵呵。看你自己喜好了 ,欢迎大家一起交流.

赞(0) 打赏
未经允许不得转载:NixonLi博客 » 打造LAPM超级服务器

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏