- 论坛徽章:
- 0
|
5.配置LAMP
系统自带安装http+php+mysql软件包,进行配置如下:
Apache配置
修改/etc/httpd/conf/httpd.conf内容如下:
- Listen 82
- ServerName 127.0.0.1:82
- DocumentRoot "/var/www/html"
- <Directory "/var/www/html">
复制代码
注意:系统已经有两个httpd服务进程.
用户分别是:xxxx apache
请确保/usr/local/apache2/bin/apachectl start
/etc/init.d/httpd start
此两个服务自启动.
Mysql设置
Mysql>create ftpdb;
Mysql>grant all privileges on ftpdb.* to ftpuser@localhost identified by “xxxx”;
Mysql>grant all privileges on *.* to root@’%’ identified by “xxxx”;
Mysql>flush privileges;
Mysql>exit
请确保
/etc/init.d/mysqld start
此服务自启动.
LAMP服务环境配置完毕.
7.配置FTP
配合工程实施与建立ftp帐号相关联,方便维护与管理,我这里选择了Proftpd与数据库结合的方式来实现的.
创建Ftpdb结构:
- Mysql>use ftpdb;
- Mysql> CREATE TABLE `ftpgroup` (
- `groupname` varchar(16) NOT NULL default '',
- `gid` smallint(6) NOT NULL default '5500',
- `members` varchar(16) NOT NULL default '',
- KEY `groupname` (`groupname`)
- ) ;
- Mysql> CREATE TABLE `ftpquotalimits` (
- `name` varchar(30) default NULL,
- `quota_type` enum('user','group','class','all') NOT NULL default 'user',
- `per_session` enum('false','true') NOT NULL default 'false',
- `limit_type` enum('soft','hard') NOT NULL default 'soft',
- `bytes_in_avail` float NOT NULL default '0',
- `bytes_out_avail` float NOT NULL default '0',
- `bytes_xfer_avail` float NOT NULL default '0',
- `files_in_avail` int(10) unsigned NOT NULL default '0',
- `files_out_avail` int(10) unsigned NOT NULL default '0',
- `files_xfer_avail` int(10) unsigned NOT NULL default '0'
- ) ;
- Mysql> CREATE TABLE `ftpquotatallies` (
- `name` varchar(30) NOT NULL default '',
- `quota_type` enum('user','group','class','all') NOT NULL default 'user',
- `bytes_in_used` float NOT NULL default '0',
- `bytes_out_used` float NOT NULL default '0',
- `bytes_xfer_used` float NOT NULL default '0',
- `files_in_used` int(10) unsigned NOT NULL default '0',
- `files_out_used` int(10) unsigned NOT NULL default '0',
- `files_xfer_used` int(10) unsigned NOT NULL default '0'
- ) ;
- Mysql> CREATE TABLE `ftpuser` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `userid` varchar(32) NOT NULL default '',
- `passwd` varchar(32) NOT NULL default '',
- `uid` smallint(6) NOT NULL default '5500',
- `gid` smallint(6) NOT NULL default '5500',
- `homedir` varchar(255) NOT NULL default '',
- `shell` varchar(16) NOT NULL default '/sbin/nologin',
- `count` int(11) NOT NULL default '0',
- `accessed` datetime NOT NULL default '0000-00-00 00:00:00',
- `modified` datetime NOT NULL default '0000-00-00 00:00:00',
- PRIMARY KEY (`id`)
- ) ;
- Mysql> INSERT INTO `ftpgroup` (`groupname`, `gid`, `members`) VALUES("5dxc", "5500", "xxxx");
- Mysql>INSERT INTO `ftpquotalimits` (`name`, `quota_type`, `per_session`, `limit_type`, `bytes_in_avail`, `bytes_out_avail`, `bytes_xfer_avail`, `files_in_avail`, `files_out_avail`, `files_xfer_avail`) VALUES("test", "user", "false", "soft", "1.024e+06", "0", "0", "0", "0", "0");
- Mysql> INSERT INTO `ftpquotatallies` (`name`, `quota_type`, `bytes_in_used`, `bytes_out_used`, `bytes_xfer_used`, `files_in_used`, `files_out_used`, `files_xfer_used`) VALUES("test", "user", "809781", "0", "809781", "0", "0", "0");
- Mysql> INSERT INTO `ftpuser` (`id`, `userid`, `passwd`, `uid`, `gid`, `homedir`, `shell`, `count`, `accessed`, `modified`) VALUES("1", "test", "test", "5500", "5500", "/site", "/sbin/nologin", "0", "0000-00-00 00:00:00", "0000-00-00 00:00:00");
复制代码
配置proftp:
- #tar xzvf proftpd-1.3.0rc5.tar.gz
- #cd proftpd-1.3.0rc5
- #./configure --prefix=/usr/local/proftpd --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql:mod_ratio --with-includes=/usr/include/mysql --with-libraries=/usr/lib/mysql
- #make&&make install
- #mv /etc/local/proftpd/etc/proftpd.conf /etc/local/proftpd/etc/proftpd.confbak
- #vi /etc/local/proftpd/etc/proftpd.conf
- ////////////////////////文件内容///////////////////
- # This is a basic ProFTPD configuration file (rename it to
- # 'proftpd.conf' for actual use. It establishes a single server
- # and a single anonymous login. It assumes that you have a user/group
- # "nobody" and "ftp" for normal operation and anon.
- #ServerName "ProFTPD Default Installation"
- ServerName "Mingfu's ftp"
- ServerType standalone
- DefaultServer on
- # Port 21 is the standard FTP port.
- Port 21
- # Umask 022 is a good standard umask to prevent new dirs and files
- # from being group and world writable.
- Umask 022
- # To prevent DoS attacks, set the maximum number of child processes
- # to 30. If you need to allow more than 30 concurrent connections
- # at once, simply increase this value. Note that this ONLY works
- # in standalone mode, in inetd mode you should use an inetd server
- # that allows you to limit maximum number of processes per service
- # (such as xinetd).
- MaxInstances 100
- MaxLoginAttempts 3
- # Set the user and group under which the server will run.
- User nobody
- Group nobody
- # To cause every FTP user to be "jailed" (chrooted) into their home
- # directory, uncomment this line.
- #DefaultRoot ~
- DefaultRoot ~
- #put the proftpd log files in /var/log/ftp.syslog
- #SystemLog /var/log/ftp.syslog
- SystemLog /var/log/xxxx/ftp.syslog
- #TransferLog log files
- TransferLog /var/log/xxxx/ftp.transferlog
- MaxHostsPerUser 1 "Sorry, you may not connect more than one time 1."
- MaxClientsPerUser 13 "Only one such user at a time 2."
- MaxClientsPerHost 20 "Sorry, you may not connect more than one time 3."
- #setup the Restart
- AllowRetrieveRestart on
- RootLogin off
- RequireValidShell off
- TimeoutStalled 600
- MaxClients 2000
- AllowForeignAddress on
- AllowStoreRestart on
- ServerIdent off
- DefaultRoot ~ xxxx
- #Slow logins
- UseReverseDNS off
- IdentLookups off
- #IdentLookups and tcpwrappers ***
- # Normally, we want files to be overwriteable.
- AllowOverwrite on
- TimeoutIdle 600
- SQLAuthTypes Backend Plaintext
- SQLAuthenticate users* groups*
- # databasename@host database_user user_password
- #SQLConnectInfo ftpdb@localhost proftpd password
- SQLConnectInfo ftpdb@localhost ftpuser xxxx
- SQLUserInfo ftpuser userid passwd uid gid homedir shell
- SQLGroupInfo ftpgroup groupname gid members
- SQLHomedirOnDemand on
- # Update count every time user logs in
- SQLLog PASS updatecount
- SQLNamedQuery updatecount UPDATE "count=count+1,accessed=now() WHERE userid='%u'" ftpuser
- # Update modified everytime user uploads or deletes a file
- SQLLog STOR,DELE modified
- SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser
- QuotaEngine on
- QuotaDirectoryTally on
- QuotaDisplayUnits kb
- QuotaShowQuotas on
- QuotaLog "/var/log/quota"
- SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM ftpquotalimits WHERE name = '%{0}'AND quota_type = '%{1}'"
- SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM ftpquotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"
- SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used+ %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{7}'" ftpquotatallies
- SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" ftpquotatallies
- QuotaLimitTable sql:/get-quota-limit
- QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally
- ////////////////////////文件内容///////////////////
复制代码
在/etc/rc.local文件中新增
- /usr/local/proftpd/sbin/proftpd &
复制代码
LPM配置完毕.
注意:以后添加ftp帐号只需操作ftpuser表添加相应字段.用户磁盘限额操作ftpquotalimits表添加相应字段.
Mysql管理win工具推荐:mysql-front
其中远程连接帐号:
User:root
Host:IP
Pswd:xxxx
(与grant all privileges on *.* to root@’%’ identified by “xxxx”;
中设置的密码一致) .
架设也可参考如下连接:
http://www.mingfor.com/forum/showthread.php?tid=28
8.配置MAIL
配合jboss工程程序实施与建立MAIL帐号相关联,方便维护与管理,我这里选择了邮件服务器与数据库结合的方式来实现的.
具体架设参考邮件发送程序,然后来配置邮件服务器,邮件系统的用户帐号不准创建真实的系统帐号,所有的帐号均建在mysql数据库中.
具体架设过程略。
架设可参考如下连接:
http://www.mingfor.com/forum/showthread.php?tid=19
http://www.extmail.org
[ 本帖最后由 foway 于 2006-5-29 01:46 编辑 ] |
|