Archive for June, 2009
简单的centos 5.3 LEMP以及vsftpd配置
linux+nginx+mysql+php
免得以后忘
1.启用EPEL,rpmforge的centos安装源,rpm -i 两个rpm包
2.安装gcc等编译工具yum install gcc …
3.安装一堆头文件如yum install pcre-devel zlib-devel libiconv-devel mysql-devel libmcrypt-devel openssl-devel ..等等
4.直接yum个mysql用.暂时不用mysqli,够了
5.转到不影响系统工作的目录,如cd ~
编译nginx ->wget www.nginx.net网站的下载链接
./configure
中间缺什么yum什么 如缺mhash就yum install libmhash-devel
make&&make install
6.编译php 先到php.net下个稳定版
./configure –enable-fastcgi –enable-zip –enable-ftp –enable-mbstring –with-gd –with-iconv –with-zlib –
with-mysqli –with-mysql –with-mcrypt –with-openssl –with-mhash –with-curl –enable-xml
开discuz论坛的话以上够用
make&&make install
8.配置vsftpd
yum install vsftpd
配置vi /etc/vsftpd/vsftpd.conf
/anonymous_enable=
YES->NO
service vsftpd start
chkconfig vsftpd on
9.设定网站目录
useradd -g ftp daminger.net
修改密码passwd daminger.net
以后可以使用此账户ssh网站/ftp网站
10.配置nginx
编译安装,默认配置文件在/usr/local/nginx
vi conf/nginx.conf
第一行user改为apache
/server 搜索
照着我的改改
server {
listen 80;
server_name daminger.net alias www.daminger.net;
location / {
root /home/daminger.net;
index index.php index.html index.htm;
}
location = /50x.html {
root html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/daminger.net/$fastcgi_script_name;
include fastcgi_params;
}
}
service httpd stop
chkconfig httpd off
关掉apache
11.设定nginx启动脚本
cd /etc/init.d
vi nginx
我的脚本.修改自nginx官方
#!/bin/sh
## nginx – this script starts and stops the nginx daemon
# modified by daming addmyin@gmail.com daminger.net
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx=”/usr/local/nginx/sbin/nginx”
prog=$(basename $nginx)
NGINX_CONF_FILE=”/usr/local/nginx/conf/nginx.conf”
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $”Starting $prog: ”
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $”Stopping $prog: ”
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest || return $?
stop
sleep 1
start
}
reload() {
configtest || return $?
echo -n $”Reloading $prog: ”
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case “$1″ in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $”Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}”
exit 2
esac
service nginx start
chkconfig nginx on
12.设定php-fcgi
首先安spawn-cgi
yum install lighttpd-fastcgi
然后在/etc/init.d里增加脚本lighttpd
#!/bin/sh
#
# chkconfig: - 85 15
# description: PHP Fast-CGI
# processname: PHP Fast-CGI
# pidfile: /var/run/php-cgi.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
SPAWNFCGI=”/usr/bin/spawn-fcgi”
FCGIPROGRAM=”/usr/local/bin/php-cgi”
FCGIPID=”/var/run/php-cgi.pid”
FCGIPORT=”9000″
FCGIADDR=”127.0.0.1″
FCGIUSER=”apache”
FCGIGROUP=”apache”
PHP_FCGI_CHILDREN=12
## maximum number of requests a single PHP process can serve before it is restarted
PHP_FCGI_MAX_REQUESTS=1000
#
lockfile=/var/lock/subsys/php-cgi
prog=$(basename ${FCGIPROGRAM})
start() {
echo -n $”Starting $prog: ”
daemon $SPAWNFCGI -f “${FCGIPROGRAM}” -a $FCGIADDR -p $FCGIPORT -C $PHP_FCGI_CHILDREN -u $FCGIUSER -g
$FCGIGROUP -P $FCGIPID >> /dev/null 2>&1
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $”Stopping $prog: ”
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
echo -ne “Restart…\n”
sleep 3
start
}
case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $”Usage: $0 {start|stop|restart}”
RETVAL=1
esac
service phplighty start
chkconfi phplighty on
运气好的话网站就跑起来了
13.补充
所有脚本必须增加执行权限chmod 777 xxx
一般没有yum不到的东西 利用yum search /list 以及goolge.com/ncr
完.
写了个配合ssh翻墙使用的pac脚本
http://daminger.net/dm.pac
顺道支持下飞速土豆。
给wm手机替换wince.nls
日本人做好现成的了http://www.geocities.jp/asukal_trader/Localize/localizecab.htm,不学你轰狗也没啥用,不过替换后日文文件名的A片就可以在手机上播了。。
听说goolge被日了
开心啊。。
打倒goolge 封我adsense。里面还有100多美金。
突然发现centos 5.3把nginx干了
郁闷。
现在貌似只能自己编译
编译nginx主要需要 pcre-devel openssl-devel这两个家伙
然后。
php5的fastcgi模式只要以后台方式运行
php-cgi -b 127.0.0.1:9000
就行。
喜欢几个进程创建几个进程
最好写到bash脚本里。
killall -9 php-cgi
php-cgi -b 127.0.0.1:9000
然后在crontab里放着。按时按需开下
如果不爽可以用现成的
spawn-fcgi 网上搜
意外发现的纳米盘机密
网站使用LNMP构架(linux+nginx+Mysql+php),squid反向代理负载均衡
mysql使用远程数据库ip地址为219.232.252.105
纳米数据库名为:db_namipan
世界上本没有牛人
牛B吹多了,也便成了牛人。
世界上本没有傻B,
以为是傻B,结果就成了傻B。
hdwiki的ucenter插件太强了
传递给uc的ip全是服务器的ip..也就是达到了匿名编辑的效果,比wiki都nb..
我再也不用免费的杀毒软件小红伞咯
Posted by admin in Uncategorized on June 19th, 2009
改用微软免费杀毒软件…microsoft security essentials ..