分类: WINDOWS
2008-04-13 22:56:15
FreeBSD6.2架设之Pure-FTPd服务器 Pure-FTPd Server On FreeBSD6.2 HowTo |
Mongolia |
简介 |
Pure-FTPd is a free (BSD), secure, production-quality and standard-conformant FTP server. It doesn't provide useless bells and whistles, but focuses on efficiency and ease of use. It provides simple answers to common needs, plus unique useful features for personal users as well as hosting providers. |
Step 1 Installation Apache22. |
whereis apache22 apache22: /usr/ports/www/apache22 cd /usr/ports/www/apache22 make install clean |
Options for apache 2.2.6_2 | |||
|
To run apache www server from startup, add apache22_enable="YES" in your /etc/rc.conf. Extra options can be found in startup script. ===> Cleaning for autoconf-wrapper-20071109 ===> Cleaning for p5-gettext-1.05_1 ===> Cleaning for apache-2.2.6_2 rehash |
vi /etc/rc.conf |
#Apache22 apache22_enable="YES" |
/usr/local/etc/rc.d/apache22 start Syntax OK Starting apache22. |
It works! |
Step 2 Installation MySQL Server. |
whereis mysql50-server mysql50-server: /usr/ports/databases/mysql50-server cd /usr/ports/databases/mysql50-server/ make install clean |
===> Cleaning for mysql-client-5.0.45_1 ===> Cleaning for mysql-server-5.0.45_1 rehash |
vi /etc/rc.conf |
#MySQL5.0 mysql_enable="YES" |
netstat -an | grep "3306" tcp4 0 0 *.3306 *.* LISTEN ps -aux|grep mysql|grep -v grep mysql 97589 0.0 0.3 1728 1376 p0 I 3:03PM 0:00.09 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/va mysql 97609 0.0 4.9 53844 25576 p0 S 3:03PM0:01.07 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysq |
mysqladmin -u root password '123456' ('123456')是你要设定的密码 |
mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.0.45 FreeBSD port: mysql-server-5.0.45_1 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.01 sec) mysql> quit Bye |
Step 3 Installation PHP5. |
whereis php5 php5: /usr/ports/lang/php5 cd /usr/ports/lang/php5/ make install clean |
Options for php5 5.2.5 | ||||||
|
*************************************************************** Make sure index.php is part of your DirectoryIndex. You should add the following to your Apache configuration file: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps *************************************************************** ===> Cleaning for pkg-config-0.22_1 ===> Cleaning for libxml2-2.6.30 ===> Cleaning for php5-5.2.5 rehash |
cd /usr/local/etc/apache22/ cp httpd.conf httpd.conf.bak |
vi /usr/local/etc/apache22/httpd.conf |
编辑/usr/local/etc/apache22/httpd.conf文件,以使Apache Server支持php
index.php AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps |
修改前:
# probably should define those extensions to indicate media types: # AddType application/x-compress .Z AddType application/x-gzip .gz .tgz |
修改后:
# 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 AddType application/x-httpd-php-source .phps |
先不要退出,添加'index.php' 到'DirectoryIndex' 主目录索引(大约212行)
Editor:
DirectoryIndex index.php index.html index.htm |
修改前:
# DirectoryIndex index.html # |
修改后:
# DirectoryIndex index.php index.html index.htm # |
whereis php5-extensions php5-extensions: /usr/ports/lang/php5-extensions cd /usr/ports/lang/php5-extensions/ make install clean |
Options for php5-extensions 1.0 | ||||||||||||
|
===> Cleaning for php5-posix-5.2.5 ===> Cleaning for php5-session-5.2.5 ===> Cleaning for php5-extensions-1.1 rehash |
cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini |
/usr/local/etc/rc.d/apache22 restart |
vi /usr/local/www/apache22/data/test.php |
phpinfo(); ?> |
Step 4 Installation Pure-FTPd. |
whereis pure-ftpd pure-ftpd: /usr/ports/ftp/pure-ftpd cd /usr/ports/ftp/pure-ftpd/ make with_language=simplified-chinese install |
Options for pure-ftpd 1.0.21_1 | ||||||||||||||||||
|
===> Compressing manual pages for pure-ftpd-1.0.21_1 ===> Registering installation for pure-ftpd-1.0.21_1 rehash |
vi /etc/rc.conf |
#Pure-FTPd pureftpd_enable="YES" |
Step 5 Creating a MySQL Database. |
cd /root/ fetch "" |
mysql -u root -p < /root/script.mysql Enter password:此处输入你的MySQL密码 |
Step 6 Configuration of PureFTPd. |
cd /usr/local/etc/ cp /usr/local/etc/pure-ftpd.conf.sample /usr/local/etc/pure-ftpd.conf |
vi /usr/local/etc/pure-ftpd.conf |
MySQLConfigFile /usr/local/etc/pureftpd-mysql.conf CreateHomeDir yes |
修改前:
# MySQL configuration file (see README.MySQL) # MySQLConfigFile /etc/pureftpd-mysql.conf # Automatically create home directories if they are missing #CreateHomeDir yes |
修改后:
# MySQL configuration file (see README.MySQL) MySQLConfigFile /usr/local/etc/pureftpd-mysql.conf # Automatically create home directories if they are missing CreateHomeDir yes |
cd /usr/local/etc/ fetch |
/usr/local/etc/rc.d/pure-ftpd start |
Step 7 User manager for PureFTPd. |
whereis usermanager usermanager: /usr/ports/www/usermanager cd /usr/ports/www/usermanager/ make install clean |
***************************************************************** Please check /usr/local/www/data/UserManager/readme.txt To use this manager, you will need to compile your Pure-FTPd with -DWITH_MYSQL ***************************************************************** 'User manager for PureFTPd' is made by M.Mastenbroek 2002 - 2005 For more info look at Version 2.1 Installation: Run the installation wizard install.php in your web browser. The installation wizard will lead you step by step through the configuration of the User manager for PureFTPd. Running: The User manager for PureFTPd starts from the index.php file. ***************************************************************** rehash |
cp /usr/local/etc/apache22/httpd.conf /usr/local/etc/apache22/httpd.conf.bak vi /usr/local/etc/apache22/httpd.conf |
Alias /ftp "/usr/local/www/data/UserManager/" AllowOverride None Options None Order allow,deny Allow from all |
Configuration 'User manager for PureFTPd' |
Step [1 - 7] | |
| ||
|
|
|
This configuration script has carried out a few checks to see if everything is ready to start the configuration. | ||
| ||
Checking if config.php exists |
OK! |
|
Checking if config.php is writable |
OK! |
|
Checking if PHP Extension MYSQL is enabled |
OK! |
|
Checking if PHP Extension PCRE is enabled |
OK! |
|
Checking if PHP Extension POSIX is enabled |
OK! |
|
Checking if PHP Extension SESSION is enabled |
OK! |
|
|
PureFTPd 帳號管理 |
按此以新增帳號 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Step 8 写在最后. |
mkdir -p /home/ftp/demo chown nobody:guest demo |
vi /usr/local/www/apache22/cgi-bin/ftpstatus.c |
#include int main(int argc, char *argv[]) { system("/usr/local/sbin/pure-ftpwho -H -w"); return 0; } |
cc -Wall -o ftpstatus ftpstatus.c chmod 755 ftpstatus chmod ug+s ftpstatus |
使用浏览器访问查看在线FTP用户状态
Pure-FTPd server status | |||||||
PID |
Account |
Time |
State |
File name |
Remote host |
Kbytes |
Local host |
11692 |
sunny |
00:01 |
UL |
file.iso |
192.168.0.8 |
5248 (79 KB/s) |
192.168.0.88:21 |