目前分類:FreeBSD (119)

瀏覽方式: 標題列表 簡短摘要

freebsd# apachectl start
[Sat Jun 11 18:46:14 2005] [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter
freebsd#


這個問題出現了一陣子,不過一開始也不知道改到了什麼

自從升級到 Apache 2.2.0 以後就有這樣的問題,但是似乎也不影響 Web 正常的運作

想說過一陣子再來找尋解決的方式 ~ 今天找到就和大家分享一下 :D

Bojack 發表在 痞客邦 留言(0) 人氣()

不知道是不是 ApachePHP 說好的


同時在 2006/05/01 Release 新的版本


有使用的人可以去 upgrade 一下你的版本喔


BTW,最近要用 PHP 處理 XML 的一些東西

Bojack 發表在 痞客邦 留言(1) 人氣()

今天重新 complier PHP 時,一直發生這行錯誤 ~




sapi/cgi/getopt.lo ..... (略)

/usr/bin/ld: cannot find -lltdl

*** Error code 1

Stop in /usr/home/sysman/php-4.4.2




過去都沒有這行訊息丫,而我先前 configure PHP 的參數如下

Bojack 發表在 痞客邦 留言(0) 人氣()

前些陣子看到 Netcraft 這個網站,只要打上你的 domain name 就可以知道過去所有有關 Web Server 的相關資訊,看起來很強大吧 :D

不過令人擔心的是,別人也能獲知同樣的資訊 ~ 這樣我的東西不就被人看光光了嗎?

要是哪一天我使用的 Web Server 有重大漏洞,且又被別人發現,那不就成為駭客眼中的肥羊了嗎?

在閱讀了有關無聊人的無聊故事這篇文章後,我也要對我的 Apache 加工啦 :D

Bojack 發表在 痞客邦 留言(0) 人氣()

優化 PHP by APC 後,再 po 一篇 Zend 篇

先連上 Zend ,看一下說明 ~ 引用一些官方網站的話\




Run encoded files and enhance the performance of your PHP scripts - FREE

The Zend Optimizer is a free application that runs the files encoded by the Zend Guard, while enhancing the performance of PHP applications.

Benefits

.Enables users to run files encoded by the Zend Guard
.Increases runtime performance up to 40%


Bojack 發表在 痞客邦 留言(0) 人氣()

最近開始在研究一些優化系統的東西 ~

今天來 PO 一篇優化 PHP 的文件,這是網友 James 和我提到的

首先連上 APC ,並且下載最新的版本(目前我用的是3.0.10)

安裝的方式介紹一下

Bojack 發表在 痞客邦 留言(0) 人氣()

ApacheMySQL 的預設連線數都是 100

顯然在大型網站是不太適用的(因為今天在台南 Demo 時發生連線數爆滿的情況 Or2)

因此尋找了一下增加連線數的參數設定

Apache 部份需要修改 httpd.conf

MaxKeepAliveRequests 10000 //我增加到 10,000 人


MySQL 的部份修改 /etc/my.cnf

set-variable = max_connections=10000 // 同樣也加到 10,000 人


Restart Apache & MySQL !!

Bojack 發表在 痞客邦 留言(0) 人氣()

最近裝了FreeBSD 6,就把一些常用的東西記下來,不過要感謝的還是其它前輩珍貴的經驗

這次參考的文章是來自於 Weithenn Study Daily

首先將 /usr/share/examples/cvsup/stable-subfile 做一些改變,改好之後就直接存檔

Bojack 發表在 痞客邦 留言(0) 人氣()

以備份資料庫為例,用 vi 寫一個 daily (技術指導:TKWU

#!/bin/sh
dt=${name2-`date "+ %d"`}
cd /www/mysql/var
/www/mysql/share/mysql/mysql.server stop
tar zcf /www/backup/database/wwwdb-`echo $dt`.tar.gz *
/www/mysql/share/mysql/mysql.server start

Bojack 發表在 痞客邦 留言(0) 人氣()

今天心血來潮,決定將學務處的 Web Server & Database 來升級一下

先前用的備配是 Apache 2.0.53 、 PHP 4.3.11 、 MySQL 3.23.58 (這也太舊了吧 XD)

目標是 Apache 2.2.0 ( 燒的唷 ) 、 PHP 4.4.2 ( 燒的唷 ) 、 MySQL 4.0.26 ( 終於邁向 4.0 )

升級的過程中,MySQL 只有一個問題,就是在 mysql table 裡面有些欄位不一致\


Bojack 發表在 痞客邦 留言(0) 人氣()

MySQL 4.0.20 + PHP 5.1.2 + Apache 2.2.0 完整安裝手冊(一般安裝法)

/*** 假設 Apache 裝在 /www 目錄, PHP裝在 /www/php, MySQL 則裝在 /www/mysql目錄下 ***/

1. 先將下列檔案拷備至 /usr/local 下,並用 tar zxvf xxxxx.tar.gz 解壓縮。
x = extract (from Archive), z = compressed, and now need to be uncompressed

‧httpd_2.2.0.tar.gz (http://www.apache.org/)

‧mysql-4.0.26.tar.gz (http://www.mysql.com/)

‧php-5.1.2.tar.gz (http://www.php.net/)

2. 安裝 mysql-4.0.26


Shell> ./configure --prefix=/www/mysql --localstatedir=/www/mysql/var --with-charset=big5 --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static
--prefix : 設定 Mysql 安裝路徑
--localstatedir : MySQL 的資料庫檔存放的目錄
--with-charset=big5
Shell> make;make install


當 MySQL 灌好之後,需先執行一個 Script 讓 MySQL 系統產生 mysql 這個資料庫及一些必要的Tables (user, db, … 等)。

Shell> /www/mysql/bin/mysql_install_db


建立好系統必要的 Grant Tables 之後我們就可以啟動 MySQL 資料庫。


Shell> chmod 700 /www/mysql/share/mysql/mysql.server
Shell> adduser mysql
Shell> chown -R mysql /www/mysql/var
Shell> /www/mysql/share/mysql/mysql.server start


設定 root 存取 MySQL 之帳號密碼。


Shell> /www/mysql/bin/mysqladmin -u root password 'Your Password'


其他查詢指令請參考相關書籍。

3. 安裝 gd (在灌 FreeBSD / Linux 時要安裝 C Development 和 Development Libaries)
(gd 為一組繪圖的 Library, 可經由 PHP 呼叫, 於網頁上即時繪圖)

另外再安裝 libmcrypt 與 libxml ,後續安裝 PHP 時所要使用的加密函式


Shell> cd /usr/ports/graphics/gd
Shell> make install clean
Shell> cd /usr/ports/security/libmcrypt
Shell> make install clean
Shell> cd /usr/ports/textproc/libxml2
Shell> make install clean
Shell> cd /usr/ports/textproc/libxslt/
Shell> make install clean


4. 安裝 Apache (httpd-2.2.0)


Shell> ./configure --prefix=/www --enable-so --enable-ssl -–enable-deflate
Shell> make; make install


--prefix : 設定 Apache httpd 安裝路徑
--enable-so : 告訴 Apache 啟動 so 模組, 讓 Apache 能夠載入 shared modules(例如 PHP)
--enable-ssl : 支援 SSL
--enable-deflate : 支援壓縮傳輸

5. 安裝 php-5.1.2


Shell> ./configure --prefix=/www/php --with-apxs2=/www/bin/apxs
--with-config-file-path=/www/php --enable-mbstring=tw --enable-ftp
--with-mysql=/www/mysql --with-iconv --with-mcrypt --with-gettext
--with-gd
--with-zlib-dir=/usr/local/lib --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/local/lib
--with-freetype-dir=/usr/local/lib --with-ttf=/usr/local/lib
--enable-gd-native-ttf --with-regex=php
Shell> make;make install
Shell> cp php.ini-dist /www/php/php.ini


6. 修改 Apache 組態檔 (/www/conf/httpd.conf)

a. 檢查是否有以下這行
LoadModule php5_module modules/libphp5.so


這行是安裝 PHP 後加上的, 不過我必須將它改成以下這行後, PHP 才能運作
(/www 為前面裝 Apache 時 –prefix 所設定之路徑)

b. 在 httpd.conf 中加入以下兩行

AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps


最後我們就可以啟動 Apache Web Server 了。

Shell> /www/bin/apachectl start


參考來源:http://jdpforum.ns2go.com/showthread.php?t=41

原文作者為:TKWU & Webber

Bojack 發表在 痞客邦 留言(0) 人氣()

首先安裝 SNMP

# cd /usr/ports/net-mgmt/net-snmp
# make install clean
# cd /usr/local/etc/rc.d
# mv snmpd snmpd.sh


接下來新增 snmpd.conf

# cd /usr/local/share/snmp
# vi snmpd.conf
rocommunity mrtg
syslocation where
syscontact bojack@bojack.idv.tw


編輯 /etc/rc.conf

snmpd_enable="YES"
snmpd_pidfile="-a -p /var/run/snmpd.pid"
snmptrapd_enable="YES"
snmptrapd_flags="-a -p /var/run/snmptrapd.pid"


開始啟動 SNMP
# /usr/local/etc/rc.d/snmpd.sh start


然後我們再來安裝 MRTG

# cd /usr/ports/net-mgmt/mrtg
# make install
# cd /usr/local/etc/mrtg
# cfgmaker mrtg@blog.bojack.idv.tw >mrtg.cfg


去修改 mrtg.cfg

Language: big5
WorkDir: /path/to/mrtg
Options[_]: growright, bits


再加入一行到 /etc/rc.conf
mrtg_daemon_enable="YES"


建立 MRTG 所要使用的 html

# cd /usr/local/etc/mrtg
# indexmaker -title '流量統計' -output /path/to/your/mrtg/index.html mrtg.cfg


複製 MRTG 所提供的圖片來美化它

# cd /usr/ports/net-mgmt/mrtg/work/mrtg* (* 指的是版本)
# cd images
# cp * /path/to/your/mrtg


啟用 MRTG 囉,一開始會有錯誤訊息 ... 多試幾次就好了
# /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg


加到 crontab ,每 5 分鐘執行一次\r
*/5 * * * * /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg


下面這幾篇可以繼續延伸閱讀一下
MRTG-CPU Loading from Weitheen
MRTG-Ram Swap from Weitheen

Bojack 發表在 痞客邦 留言(0) 人氣()

新增 /etc/make.conf 內容如下

SUP_UPDATE=yes
SUP=/usr/local/bin/cvsup
SUPFLAGS=-g -L 2
SUPHOST=cvsup.tw.FreeBSD.org
SUPFILE=/usr/share/examples/cvsup/stable-supfile
PORTSSUPFILE=/usr/share/examples/cvsup/ports-supfile
MASTER_SITE_BACKUP?= \
ftp://cvsup.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://cvsup2.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://cvsup3.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://cvsup4.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://cvsup5.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://cvsup7.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://cvsup8.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://cvsup9.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://cvsup11.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://cvsup12.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/
MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP}
# added by use.perl 2006-03-27 15:04:31
PERL_VER=5.8.8
PERL_VERSION=5.8.8

接著安裝 cvsup 這個更新程式

# cd /usr/ports/net/cvsup-without-gui/
# make install clean
# rehash

以後就到 /usr/ports 打 make update 就行啦!

Bojack 發表在 痞客邦 留言(0) 人氣()

#
#bojack.idv.tw
#

ServerAdmin Admin's Email
DocumentRoot /Path
ServerName Your Domain Name
ErrorLog /www/logs/error_log
CustomLog /www/logs/access_log combined

AllowOverride All
Order allow,deny
Allow from all

Bojack 發表在 痞客邦 留言(0) 人氣()

ifconfig em0 down -------->假設em0是我的網卡...
ifconfig em0 delete
ifconfig em0 xx.xx.xx.xx netmask xx.xx.xx.xx

這樣就可以了!

Bojack 發表在 痞客邦 留言(0) 人氣()

首先安裝 gnuls


# cd/usr/ports/misc/gnuls
# make install clean


設定 /etc/csh.cshrc ( 或 user 家目錄下的 .cshrc )
alias ls 'gnuls --color=auto --show-control-chars'

Bojack 發表在 痞客邦 留言(0) 人氣()

這篇文章是在二年前寫的吧,真懷念 :p

Environment:FreeBSD 4.7
一張網卡就夠了 !!!
首先,必須修改你的Kernel支援nat and firewall
.修改kernel
 #cd /usr/src/sys/i368/conf
#vi GENERIC

Bojack 發表在 痞客邦 留言(0) 人氣()

以下將介紹如何在FreeBSD上安裝Mail Server(Cyrus_SASL + CA + Sendmail )

事前準備工作:

修改/etc/make.conf並加入以下設定。因為使用網路取得檔案時,預設抓取檔案的伺服器通常在國外
,因此修改/etc/make.conf並加入以下四行來指定使用國內的FTP站台。

MASTER_SITE_BACKUP?=
ftp://freebsd.csie.ncu.edu.tw/distfiles/${DIST_SUBDIR}/
ftp://freebsd.csie.nctu.edu.tw/pub/distfiles/${DIST_SUBDIR}/
MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP}

Bojack 發表在 痞客邦 留言(0) 人氣()

1. 上proftpd的網站下載最新的版本(撰寫時的版本為1.2.10)

2. 解開檔案並安裝...
# tar zxvf proftpd-1.2.10.tar.gz
# cd proftpd-1.2.10


我的需求是要支援MySQL & SSL ( TLS )



# ./configure --with-modules=mod_tls \
? --with-modules=mod_sql:mod_sql_mysql \
? --with-includes=/usr/local/include \
? --with-libraries=/usr/local/lib/mysql
# make
# make install



3. 接下來製作憑證



# mkdir /etc/ssl/certs
# mkdir /etc/ssl/private
# chmod og-rwx /etc/ssl/private
# mkdir /etc/ssl/crl
# mkdir /etc/ssl/newcerts


修改 /etc/ssl/openssl.cnf
把 dir = ./demoCA 改成 dir = /etc/ssl


製作最高層認證中心 (Root CA)

Private Key ( Public Key )

# openssl genrsa -des3 -out /etc/ssl/private/myrootca.key 2048
# chmod og-rwx /etc/ssl/private/myrootca.key



填寫憑證申請書 (然後按照問題回答即可)

# openssl req -new -key /etc/ssl/private/myrootca.key -out /tmp/myrootca.req




簽發憑證

# openssl x509 -req -days 7305 -sha1 -extfile /etc/ssl/openssl.cnf
-extensions v3_ca -signkey /etc/ssl/private/myrootca.key -in /tmp/myrootca.req -out /etc/ssl/certs/myrootca.crt



# rm -f /tmp/myrootca.req

製作伺服器用的憑證


Private Key ( Public Key )

# openssl genrsa -out /etc/ssl/private/myhost.key 2048
# chmod og-rwx /etc/ssl/private/myhost.key


填寫憑證申請書
# openssl req -new -key /etc/ssl/private/myhost.key -out /tmp/myhost.req



用最高層認證中心簽發憑證

# openssl x509 -req -days 3650 -sha1 -extfile /etc/ssl/openssl.cnf
-extensions v3_req -CA /etc/ssl/certs/myrootca.crt -CAkey /etc/ssl/private/myrootca.key -CAserial /etc/ssl/myrootca.srl -CAcreateserial -in /tmp/myhost.req -out /etc/ssl/certs/myhost.crt




# rm -f /tmp/myhost.req

參考自這個網址:http://std1.mis.yzu.edu.tw/~s882617/FNP/proftpd_tls.htm

4. 接下來設定/usr/local/etc/proftpd.conf,主要是在最後加上以下有關TLS的設定


< IfModule mod_tls.c >
TLSEngine on
TLSLog /var/log/tls.log
TLSProtocol SSLv23
TLSOptions NoCertRequest
TLSRequired On
TLSRSACertificateFile /etc/ssl/certs/myhost.crt
TLSRSACertificateKeyFile /etc/ssl/private/myhost.key
TLSCACertificateFile /etc/ssl/certs/myrootca.crt
TLSVerifyClient On
< /IfModule>

Bojack 發表在 痞客邦 留言(0) 人氣()