Home  >  Article  >  Database  >  Ubuntu 8.10下快速架设Nginx2.6+PHP5.2.6+MySQL5.0

Ubuntu 8.10下快速架设Nginx2.6+PHP5.2.6+MySQL5.0

WBOY
WBOYOriginal
2016-06-07 16:53:51824browse

Nginx的高效率是出了名了,最近想用它把Ubuntu 8.10服务器上的Apache换掉,所以先在本地机上做了下测试。下面为记录下的步骤!第

Nginx的高效率是出了名了,最近想用它把Ubuntu 8.10服务器上的Apache换掉,所以先在本地机上做了下测试。

下面为记录下的步骤!
第一步,,安装mysql
sudo apt-get install mysql-server

第二步,安装php-cgi及所需gd库等
sudo apt-get install php5-cli php5-cgi php5-mysql php5-gd php5-mcrypt

第三步,安装nginx
sudo apt-get install nginx

第四步,从lighttpd中取得spawn-fcgi
apt-get install lighttpd
cp /usr/bin/spawn-fcgi ./
apt-get remove lighttpd
cp spawn-fcgi /usr/bin/
sudo vi /usr/bin/php-fastcgi
#!/bin/sh
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 10 -u www-data -g www-data -f /u    sr/bin/php-cgi

#注意 -C 10 表示开启10个php-cgi进程!
sudo chmod 755 /usr/bin/php-fastcg
sudo vi /etc/init.d/init-fastcgi
C++代码
#!/bin/bash
PHP_SCRIPT=/usr/bin/php-fastcgi
RETVAL=0
case "$1" in
start)
$PHP_SCRIPT
RETVAL=$?
;;
stop)
killall -9 php5-cgi
RETVAL=$?
;;
restart)
killall -9 php5-cgi
$PHP_SCRIPT
RETVAL=$?
;;
*)
echo "Usage: php-fastcgi {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL
chmod 755 /etc/init.d/php-fastcgi
开启spawn-fcgi
/etc/init.d/php-fastcgi start
写入开机启动!
update-rc.d php-fastcgi defaults
查看php-cgi进程
ps ax | grep php5-cgi

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn