八月 4th, 2010
需要做编译安全Nginx的时候,加上–with-http_ssl_module这个参数,下面是自己常用的nginx编译参数:
./configure –prefix=%{_prefix} –user=%{_user} –group=%{_group} –with-http_stub_status_module –without-select_module –without-poll_module –with-http_realip_module –with-http_sub_module –without-http_userid_module –without-http_geo_module –without-http_memcached_module –without-http_map_module –without-mail_pop3_module –without-mail_imap_module –without-mail_smtp_module –with-http_ssl_module
安装好openssl和openssl-devel后,使用openssl生成证书:
$ cd /usr/local/nginx/conf
$ openssl genrsa -des3 -out server.key 1024
$ openssl req -new -key server.key -out server.csr
$ cp server.key server.key.org
$ openssl rsa -in server.key.org -out server.key
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
配置nginx.conf:
server {
server_name YOUR_DOMAINNAME_HERE;
listen 443;
ssl on;
ssl_certificate /usr/local/nginx/conf/server.crt;
ssl_certificate_key /usr/local/nginx/conf/server.key;
}
至此完成,如果需要全球信任的证书,则的自己购买进行安装
Filed in linux,nginx
- Tags: https, nginx, ssl
-
0 Comments
七月 26th, 2010
Checkinstall 用于创建简单的 deb 安装包的确十分方便。除了安装、卸载方便之外,你还可以与他人分享。而且,其创建过程也是非常容易。
1.安装checkinstall
apt-get install checkinstall
2.下载要制作 deb 包的程序源码,准备好依赖,解压,进入目录配置并编译
./configure
make
3.使用checkinstall生成deb包,按提示完成即可
checkinstall -D make install
4.在编译的目录里可以找到创建好的 deb 包,使用 dpkg -i 或 dpkg -r 就可以方便地安装或是卸载了。
checkinstall 还可以方便的制作 rpm tgz包
完成!
Filed in debian,linux
- Tags: checkinstall, deb, debian
-
0 Comments
七月 15th, 2010
break 跳出最近的循环(就是跳出整个循环语句)
continue 跳到最近所在循环的开头处(来到循环的首行)
pass 啥事不做,只是空占位语句
循环else 只有当循环正常离开时,才执行(也就是没有遇到break的语句)
Filed in python
-
0 Comments
七月 6th, 2010
while True:
reply = raw_input(‘Enter text:’)
if reply == ‘stop’:
break
elif not reply.isdigit():
print ‘Bad’ ** 8
else:
print int(reply) * 2
print ‘Bye’
raw_input() 读取标准输入函数
isdigit() 半段是否数字的函数
print ‘Bad’ ** 8 连续打印‘Bad’8次
Filed in python
-
0 Comments
四月 12th, 2010
例:
#!/bin/sh
mysql -uroot -p123456 <<EOF
use test;
select * from testaa while a=10000;
EOF
脚本会直接将从mysql中查询到的结果打印出来,而不是连接到mysql后等待你的输入。
Here Documents的官方解释:http://www.linuxsir.org/main/doc/abs/abs3.7cnhtm/here-docs.html
Filed in 幸福录音带
- Tags: EOF, shell
-
0 Comments