月度归档:2010年07月

Debian 下 安装配置nginx ,mysql ,运行PHP

在网上找了一下LNMP配置,大多是羽飞写的: Debian VPS打造LNMP服务器(Debian_Nginx_PHP(FastCGI)_MySQL_搭建LNMP服务器(一版).pdf)

下载文件

,我也是参照这份文档来安装配置的,我把这PDF放上来,如果正常的话按照这个来配置是没问题的。只是我是新手,走了很多弯路,结果在虚拟机了装了3次系统,终于还是搞定的(主要是卸载麻烦,一个包又依赖另一个包),被卡住我的地方还是因为“E: 无法找到软件包”这样的错误,而引起这个原因都是因为/etc/apt-get/source.list配置有问题,所以一直找不到要下载的软件包,在网上搜索一下source.list,vim /etc/apt-get/source.list 键入命令:a 添加以下地址

deb http://volatile.debian.org… lenny/volatile main

deb-src http://volatile.debian.org… lenny/volatile main

deb http://debian.cn99.com/deb… main non-free contrib

deb http://debian.cn99.com/deb… stable/non-US main contrib non-free

deb http://debian.cn99.com/deb… proposed-updates main contrib non-free

deb http://debian.cn99.com/deb… proposed-updates/non-US main contrib non-free

deb http://debian.cn99.com/deb… woody/updates main contrib non-free

deb-src http://debian.cn99.com/deb… stable main non-free contrib

deb-src http://debian.cn99.com/deb… stable/non-US main contrib non-free

deb-src http://debian.cn99.com/deb… proposed-updates main contrib non-free

deb-src http://debian.cn99.com/deb… proposed-updates/non-US main contrib non-free

更新一下apt-get

#apt-get update

然后根据上面的PDF文档基本上所有的包都能找到并装上了~!上面PDF把PHP启动脚本的“|”号变成ASCII码了,改为:

mysql_port=3306

mysql_username=”admin”

mysql_password=”12345678″

function_start_mysql()

{

    printf “Starting MySQL…\n”

    /bin/sh /usr/local/webserver/mysql/bin/mysqld_safe –defaults-file=/data0/mysql/${mysql_port}/my.cnf 2>&1 > /dev/null &

}

function_stop_mysql()

{

    printf “Stoping MySQL…\n”

    /usr/local/webserver/mysql/bin/mysqladmin -u ${mysql_username} -p${mysql_password} -S /tmp/mysql.sock shutdown

}

function_restart_mysql()

{

    printf “Restarting MySQL…\n”

    function_stop_mysql

    sleep 5

    function_start_mysql

}

function_kill_mysql()

{

    kill -9 $(ps -ef |  grep 'bin/mysqld_safe' |  grep ${mysql_port} |  awk '{printf $2}')

    kill -9 $(ps -ef |  grep 'libexec/mysqld' |  grep ${mysql_port} |  awk '{printf $2}')

}

if [ “$1″ = “start” ]; then

    function_start_mysql

elif [ “$1″ = “stop” ]; then

    function_stop_mysql

elif [ “$1″ = “restart” ]; then

function_restart_mysql

elif [ “$1″ = “kill” ]; then

function_kill_mysql

else

    printf “Usage: /data0/mysql/${mysql_port}/mysql {start| stop| restart| kill}\n”

fi