星期二, 十二月 11, 2012

Apache JK with https


#configuration with https
#<apache_home>/conf/httpd.conf
LoadModule ssl_module modules/mod_ssl.so 
Include conf/extra/httpd-ssl.conf 
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

#<apache_home>/conf/extra/httpd-ssl.conf
SSLCertificateFile "<apache_home>/conf/server.crt"
SSLCertificateKeyFile "<apache_home>/conf/server.key"

#generate key and certification
<apache_home>/bin>openssl genrsa -out server.key 1024
<apache_home>/bin>openssl req -new –out server.csr -key server.key -config ../conf/openssl.cnf

<apache_home>/bin>openssl genrsa -out ca.key 1024
<apache_home>/bin>openssl req -new -x509 -days 365 -key ca.key -out ca.crt -config ../conf/openssl.cnf
<apache_home>/bin>openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config ../conf/openssl.cnf

<apache_home>/bin>mkdir demoCA
<apache_home>/bin>touch demoCA/index.txt
<apache_home>/bin>echo 01 > demoCA/serial
<apache_home>/bin>mkdir demoCA/newcert

<apache_home>/bin>cp server.crt <apache_home>/conf
<apache_home>/bin>cp server.key <apache_home>/conf

#configration jk with https
#<apache_home>/conf/httpd.conf
LoadModule jk_module modules/mod_jk.so

<IfModule jk_module>
JkWorkersFile conf/workers.properties
JkMountFile conf/uriworkermap.properties
JkLogFile     logs/mod_jk.log
JkLogLevel    info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
</IfModule>

#<apache_home>/conf/extra/httpd-ssl.conf
JkMountFile conf/uriworkermap.properties

#<apache_home>/conf/uriworkermap.properties
/test/*=load_balancer
/jkstatus=jkstatus

#<apache_home>/conf/workers.properties
worker.list=load_balancer,jkstatus

worker.server2.host=localhost
worker.server2.port=8010
worker.server2.type=ajp13
worker.server2.lbfactor=1

worker.load_balancer.type=lb
worker.load_balancer.balanced_workers=server2
worker.jkstatus.type=status

星期二, 十一月 06, 2012

rhel-6.2下ISO文件作为yum更新源


1. 挂载ISO文件。

mount -t iso9660 -o loop /home/bulain/rhel/rhel-server-6.2-x86_64-dvd.iso /mnt/iso


2. 将yum源指向挂载文件。
mv /etc/yum.repos.d/rhel-source.repo /etc/yum.repos.d/rhel-source.repo.bak
vim /etc/yum.repos.d/yum.repo
[cd]
name=cd
baseurl=file:///mnt/iso
enabled=1
gpgcheck=0

星期六, 十月 08, 2011

Installing ReviewBoard on Ubuntu

// Installing Setuptools
# apt-get install python-setuptools

// Installing Python Development Headers
# apt-get install python-dev

// Installing Memcached
# apt-get install memcached
# apt-get install python-memcached

// Installing Patch
# apt-get install patch

// Installing Python LDAP
# apt-get install python-ldap

// Installing Mysql
# apt-get install mysql-server
# apt-get install mysql-client
# apt-get install python-mysqldb
# mysql -u root -p
> create database reviewboard;
> grant all on reviewboard.* to reviewboard@localhost identified by 'reviewboard';

// Installing Subversion
# apt-get install subversion
# apt-get install python-svn

// Installing Git
# apt-get install git-core

// Installing ReviewBoard
# wget http://downloads.reviewboard.org/releases/ReviewBoard/1.6/ReviewBoard-1.6.1.tar.gz
# tar zxvf ReviewBoard-1.6.1.tar.gz
# cd ReviewBoard-1.6.1
# python ./setup.py install

// Installing Site
# rb-site install /usr/local/reviewboard
# chown -R www-data /usr/local/reviewboard/htdocs/media/uploaded
# chown -R www-data /usr/local/reviewboard/data
//  Config site with apache or lighttpd using reviewboard/conf/*.conf

// Installing post-review
# wget http://downloads.reviewboard.org/releases/RBTools/0.3/RBTools-0.3.4.tar.gz
# tar zxvf RBTools-0.3.4.tar.gz
# cd RBTools-0.3.4
# python ./setup.py install

星期五, 十月 07, 2011

SPI & API


Service Provider Interface (SPI): 
The SPI is the description of classes/interfaces/methods/... that you extend and implement to achieve a goal.

Application Programming Interface (API): 
The API is the description of classes/interfaces/methods/... that you call and use to achieve a goal.

星期六, 八月 13, 2011

浏览器默认回车键触发表单提交


前提:
submit写法:<intput type='submit'/>, <button type='submit'/>
button写法:<intput type='button'/>, <button type='button'/>
text写法:<intput type='text'/>

结论:
1、当form中至少有一个submit时,回车键生效。
2、当form中只有一个text时,回车键生效。
3、当按钮使用<input>,而是用<button>,并且没有加type,IE下默认为type=button,Firefox默认为type=submit。
4、其他form元素如textarea、select不影响,radio checkbox不影响触发规则,但本身在Firefox下会响应回车键,在IE下不响应。
5、type=”image”的input,效果等同于type=”submit”,但后面会跟一个X=&Y=的坐标。

星期四, 四月 21, 2011

Redhat AS5下FTP配置

遇到的问题:
vsftpd 500 OOPS: cannot change directory
#setsebool -P ftpd_disable_trans 1
#/etc/init.d/vsftpd restart

#/etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=NO
anon_mkdir_write_enable=NO
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
ftpd_banner=Welcome to blah FTP service.
chroot_local_user=NO
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

星期日, 四月 10, 2011

Rails 3可能遇到的问题

1,windows下mysql驱动问题, 不用安装mysql2,而用mysql,具体如下。
#修改Gemfile
#gem 'mysql2'
gem 'mysql'

#运行命令
bundle install

#修改环境变量
将%MYSQL_HOME%\bin\加入PATH。

#修改database.yml
修改adapter使用mysql。

2, 使用jQuery,而不用Prototype。
参见:https://github.com/rails/jquery-ujs
#修改Gemfile
gem 'jquery-rails'

#运行命令
bundle install

#修改environment.rb
require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

#运行命令
rails generate jquery:install

要使用JQuery UI,请使用:rails generate jquery:install --ui