日期:2014-05-16  浏览次数:20657 次

ubuntu 11.04 配置nginx +php+mysql

1、首先安装aginx

?

sudo apt-get install nginx

?

启动nginx

?

/etc/init.d/nginx start

?

你会看到? wellcome nginx

?

2、安装php

apt-get install php5-cli php5-cgi spawn-fcgi 

3安装mysql

sudo apt-get install mysql-server mysql-client



4、修改Nginx的配置文件,位于/etc/nginx/sites-available下的default文件:
在root /usr/share/nginx/www;下的index index.html index.html;一行中添加index.php为:

1 index index .php index .html index .htm;

之后去掉下面代码前的注释:

1 location ~ \.php$ {
2 fastcgi_pass 127.0.0.1:9000;
3 fastcgi_index index .php;
4 include fastcgi_params;
5 }

保存~然后重启Nginx:

需要启动 fast-cgi

spawn -a 127.0.0.1
1 sudo /etc/init.d/nginx stop
2 sudo /etc/init.d/nginx start
http://library.linode.com/web-servers/nginx/php-fastcgi/ubuntu-11.04-natty

http://puras.cn/?p=85