[Linux] Ubuntu 6.06 Proftpd + Mysql 安裝方式

ProFTPD Version 1.2.10 Mysql Version 4.1.0 支援 UTF8 請確定你的proftpd有支援sql module
proftpd -l | grep mysql

proftpd -l | grep sql
mod_sql.c
mod_sql_mysql.c
mod_quotatab_sql.c
確定有支援之後 再來就是建立mysql資料庫 * 建立 proftp 資料庫
CREATE DATABASE `ftp` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
* 建立使用者資料表
 CREATE TABLE `ftp` (
`username` varchar( 60 ) default NULL ,
`uid` int( 11 ) NOT NULL ,
`gid` int( 11 ) default NULL ,
`password` varchar( 30 ) default NULL ,
`homedir` varchar( 60 ) default NULL ,
`shell` varchar( 11 ) default ‘/bin/false’,
PRIMARY KEY ( `uid` ) ,
UNIQUE KEY ( `username` )
) TYPE = MYISAM;
此資料表是在紀錄使用者的基本資訊,uid是使用者系統uid,gid是使用者group的id,passwd使用者的密碼 homedir為使用者登入的家目錄, shell可以為該使用者指定相應的shell * 建立使用者群組資料表
 CREATE TABLE `groups` (
`groupname` varchar( 30 ) NOT NULL default ‘’,
`gid` int( 11 ) NOT NULL default ‘0′,
`members` text default NULL
) TYPE = MYISAM;
其中grpname是組的名稱,gid是系統組的ID,members是組的成員。注意:多成員,他們之間要用逗號隔開,不能使用空格 例如 3個使用者 test1 test2 test3 ,members就要寫 (test1,test2,test3) #設置MySQL認證: SQLConnectInfo 資料庫 資料庫帳號 資料庫密碼 #設置user資料表資訊『對應你的設定的資料表』 SQLUserInfo ftp username password uid gid homedir shell #設置group資料表資訊『對應你的設定的資料表』 SQLGroupInfo groups groupname gid members #設定使用者密碼編碼方式 ex:Plaintext 純文字 SQLAuthTypes Plaintext #設定mysql log檔 SQLLogFile /var/log/sql.log PersistentPasswd off #如果home目錄不存在,則系統會為根據它的home項新建一個目錄: SQLHomedirOnDemand on 再來呢,建立ftp的專屬group,當然你如果有許多群組,請自行建立 1. 建立groupgroupadd ftpgroup 2. 建立一個使用者home目錄
useradd -G ftpgroup -d /home/ftp -m -s /bin/false ftp
為FTPUSR建立HOME,把所有的FTP user 活動空間全放在此目錄下:
mkdir /home/ftp #剛剛建立使用者已經建立了
chown -R ftp:ftpgroup /home/ftp
開始建立ftp的使用者,可以的話利用phpmyadmin
INSERT INTO user (`userid`, `passwd`, `uid`, `gid`, `home`, `shell`) values (’test’, ‘1234′, ‘1000′, ‘1001′, ‘/home/ftp/’, ‘/bin/false’ );
INSERT INTO `groups` VALUES (’ftpgroup’, 1001, ‘test’);
上面那個是新增group對應使用者,如果你有多個使用者對應到同一個group 那麼你就要修改 group 改成 VALUES (’ftpgroup’, 1001, ‘test1,test2,test3′) 所以每增加一個使用者,就要去修改一次,有點麻煩,不過寫程式就可以解決了 大致上是如此,有問題在提出吧 我的proftpd.conf設定檔 http://bbs.ee.ndhu.edu.tw/~appleboy/proftpd.conf

[FreeBSD] 安裝Awstats 6.6

安裝路徑
cd /usr/ports/www/awstats-devel/ 安裝好之後 請在 httpd.conf 最後面加入 # Directives to allow use of AWStats as a CGI # Alias /awstatsclasses “/usr/local/www/awstats/classes/” Alias /awstatscss “/usr/local/www/awstats/css/” Alias /awstatsicons “/usr/local/www/awstats/icons/” ScriptAlias /awstats/ “/usr/local/www/awstats/cgi-bin/”
執行 /usr/local/www/awstats/tools/awstats_configure.pl 會出現錯誤訊息~
Error: Failed to open ‘/usr/local/www/awstats/wwwroot/cgi-bin/awstats.model.conf’ for read. Error: AWStats database directory defined in config file by ‘DirData’ parameter (/var/lib/awstats) does not exist or is not writable. Setup (‘/etc/awstats/awstats.192.168.100.244.conf’ file, web server or permissions) may be wrong. Check config file, permissions and AWStats documentation (in ‘docs’ directory).
建立 /var/lib/awstats 目錄,並給予 777 之權限 chmod 777 /var/lib/awstats 註:若不給予777權限,將來若設定 AllowToUpdateStatsFromBrowser=1 時,會無法透過Browser來即時更新Report
—– AWStats awstats_configure 1.0 (build 1.6) (c) Laurent Destailleur —– This tool will help you to configure AWStats to analyze statistics for one web server. You can try to use it to let it do all that is possible in AWStats setup, however following the step by step manual setup documentation (docs/index.html) is often a better idea. Above all if: – You are not an administrator user, – You want to analyze downloaded log files without web server, – You want to analyze mail or ftp log files instead of web log files, – You need to analyze load balanced servers log files, – You want to ‘understand’ all possible ways to use AWStats… Read the AWStats documentation (docs/index.html). —–> Running OS detected: Linux, BSD or Unix Warning: AWStats standard directory on Linux OS is ‘/usr/local/awstats’. If you want to use standard directory, you should first move all content of AWStats distribution from current directory: /usr/local/www/awstats to standard directory: /usr/local/awstats And then, run configure.pl from this location. Do you want to continue setup from this NON standard directory [yN] ? y —–> Check for web server install Enter full config file path of your Web server. Example: /etc/httpd/httpd.conf Example: /usr/local/apache2/conf/httpd.conf Example: c:Program filesapache groupapacheconfhttpd.conf Config file path (‘none’ to skip web server setup): > /usr/local/etc/lighttpd.conf —–> Check and complete web server config file ‘/usr/local/etc/lighttpd.conf’ AWStats directives already present. —–> Update model config file ‘/usr/local/www/awstats/cgi-bin/awstats.model.conf’ File awstats.model.conf updated. —–> Need to create a new config file ? Do you want me to build a new AWStats config/profile file (required if first install) [y/N] ? y —–> Define config file name to create What is the name of your web site or profile analysis ? Example: www.mysite.com Example: demo Your web site, virtual server or profile name: > bbs.ee.ndhu.edu.tw —–> Define config file path In which directory do you plan to store your config file(s) ? Default: /etc/awstats Directory path to store config file(s) (Enter for default): > /usr/local/etc —–> Create config file ‘/usr/local/etc/awstats.bbs.ee.ndhu.edu.tw.conf’ Config file /usr/local/etc/awstats.bbs.ee.ndhu.edu.tw.conf created. —–> Add update process inside a scheduler Sorry, configure.pl does not support automatic add to cron yet. You can do it manually by adding the following command to your cron: /usr/local/www/awstats/cgi-bin/awstats.pl -update -config=bbs.ee.ndhu.edu.tw Or if you have several config files and prefer having only one command: /usr/local/www/awstats/tools/awstats_updateall.pl now Press ENTER to continue… A SIMPLE config file has been created: /usr/local/etc/awstats.bbs.ee.ndhu.edu.tw.conf You should have a look inside to check and change manually main parameters. You can then manually update your statistics for ‘bbs.ee.ndhu.edu.tw’ with command: > perl awstats.pl -update -config=bbs.ee.ndhu.edu.tw You can also read your statistics for ‘bbs.ee.ndhu.edu.tw’ with URL: > http://localhost/awstats/awstats.pl?config=bbs.ee.ndhu.edu.tw Press ENTER to finish…
執行 /usr/local/www/awstats/cgi-bin/awstats.pl -update -config=bbs.ee.ndhu.edu.tw From data in log file “/var/log/lighttpd.access.log”… Phase 1 : First bypass old records, searching new record… Searching new records from beginning of log file… Phase 2 : Now process new records (Flush history on disk after 20000 hosts)… Jumped lines in file: 0 Parsed lines in file: 11219 Found 0 dropped records, Found 6 corrupted records, Found 0 old records, Found 11213 new qualified records. 成功訊息 設定進入該網址的權限

    Options None
    AllowOverride None
    Order allow,deny
    Allow from 192.168.130.211 192.168.160.109

Demo http://bbs.ee.ndhu.edu.tw/awstats/awstats.pl?config=bbs.ee.ndhu.edu.tw lighttpd http://trac.lighttpd.net/trac/wiki/#ReferenceDocumentation Awstats設定檔

[FC4] 限制connection 連線數目「架設war3伺服器」

fc4作業系統 預設 有連線數目的限制 還有使用者連線的限制 不過解決方法很容易 http://www.ithome.com.tw/plog/index.php?op=ViewArticle&articleId=761&blogId=131 我查到的解決方式 我改完之後如下
core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited pending signals (-i) 16255 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 819200 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 102400 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
ulimit:顯示(或設定)用戶可以使用的資源限制 ulimit -a 顯示用戶可以使用的資源限制 ulimit unlimited 不限制用戶可以使用的資源,但本設定對可打開的最大文件數(max open files) 和可同時執行的最大進程數(max user processes)無效 ulimit -n <可以同時打開的檔案數> 設定用戶可以同時打開的最大檔案數(max open files) 例如:ulimit -n 8192 如果本參數設定過小,對於併發訪問量大的網站,可能會出現too many open files的錯誤 ulimit -u <可以執行的最大併發進程數> 設定用戶可以同時執行的最大進程數(max user processes) 例如:ulimit -u 1024

[FreeBSD] Proftpd + SSL 虛擬帳號設定安裝

系統 ubuntu 6.06 + proftpd 1.2.10
TLSEngine on
TLSLog /var/log/proftpd-tls.log
TLSProtocol TLSv1
TLSRequired on
TLSRSACertificateFile /etc/proftpd/HostCA.crt
TLSRSACertificateKeyFile /etc/proftpd/HostCA.key
TLSCACertificateFile /etc/proftpd/RootCA.crt
TLSVerifyClient off
虛擬帳號實做
AuthUserFile /etc/proftpd/proftpd.passwd
AuthGroupFile /etc/proftpd/proftpd.group
SystemLog /etc/proftpd/proftpd.syslog 

TransferLog /var/log/xferlog
LogFormat awstats "%t %h %u %m %f %s %b"
ExtendedLog /var/log/xferlog read,write awstats
在linux底下如何新增帳號:
ftpasswd --passwd --file=/etc/proftpd/proftpd.passwd --name=test --uid=2000 --gid=1001 --home=/home/ftp --shell=/bin/false

FreeBSD + Lighttpd + php + mysql 安裝過程

http://gslin.org/2004/10/12/61/
系統環境 :FreeBSD 6.0-RELEASE 安裝過程如下:
  1. mysql-server-5.0.24a
  2. php5-5.1.6
  3. lighttpd-1.4.11_1
先安裝 lighttpd
cd /usr/ports/www/lighttpd/ make config [X] OPENSSL Enable SSL support [ ] OPENLDAP Enable LDAP support [X] MYSQL Enable MYSQL support [X] IPV6 Enable IPV6 support [X] CML Enable Cache Meta Language support make install clean
安裝 mysql cd /usr/ports/databases/mysql50-server make install clean WITH_CHARSET=utf8 WITH_LINUXTHREADS=yes 安裝 php cd /usr/ports/lang/php5 cd /usr/ports/lang/php5-extensions/ make config 選擇你想要的 extensions 灌好之後 就可以用了 然後打開 家目錄設定 userdir.path = “public_html” userdir.basepath = “/home/” 重點來了 如果執行網頁 http://localhost/phpinfo.php 出現 550 error 則你忘記執行fastcgi php-cgi -v PHP 5.1.6 (cgi-fcgi) (built: Sep 19 2006 22:42:28) (DEBUG) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies 然後執行 php-cgi -b 127.0.0.1:81 & 即可 port部份 隨機bind一個即可 lighttpd 設定檔