ubuntu11.04源安装nginx+php+mysql

首先执行
sudo apt-get update
sudo apt-get dist-upgrade

更新系统环境
接着安装nginx
sudo apt-get install nginx
service nginx start

安装成功后访问服务器 看到 “Welcome to nginx”表示安装成功
11.04源安装的nginx版本已经很新了,是8.5.2版的,我们没必要再更新了
接着安装php
sudo apt-get install php5-cli php5-common php5-suhosin php5-fpm php5-cgi
之后修改nginx的配置文件使其支持php
vim /etc/nginx/nginx.conf #打开配置文件 在其中的http配置段加下如下配置
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;

#在server段加入
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
}
#在server段最后加入
include vhost/*.conf;

重启nginx和php-fpm:
sudo/etc/init.d/nginx restart
sudo /etc/init.d/php5-fpm restart

之后要建立虚拟主机就把配置文件丢到/etc/nginx/vhost就好了
最后安装mysql
sudo apt-get install mysql-server
安装的时候会提示让你输入ROOT密码

OK 搞定

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注