Ubuntu 10. 04
服务器配置:
1.添加apt源
vi /etc/apt/sources.list
添加:
deb http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
deb http://ppa.launchpad.net/nginx/stable/ubuntu lucid main
deb http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main
2. 最后一行为nginx的ppa源,需要添加key,执行下面命令
apt-key adv --keyserver keyserver.Ubuntu.com --recv-keys C300EE8C
3.更新apt源
apt-get update
4.安装nginx+php+mysql
apt-get install nginx php5-common php5-dev php5-cgi php5-fpm php-apc php5-mysql php5-curl php5-gd php5-idn php-pear php5-mcrypt php5-memcache php5-ming php5-recode php5-tidy php5-xmlrpc php5-xsl mysql-server
server nginx start
访问你的ip看能不能看到nginx的欢迎界面,如果可以看到请接着往下做。如果不能访问那么请检查,等可以访问了再往下做
5.配置nginx
vi /etc/nginx/sites-enabled/default
修改
root /var/share/nginx/nginx-default;
为
root /var/www/
修改
index index.html index.htm;
为
index index.php index.html index.htm;
修改
# location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# include fastcgi_params;
#}
为
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
6.创建phpinfo测试文件
cat >/var/www/index.php<
phpinfo();
?>
EOF
8.启动nginx&#xff0c;php&#xff0c;mysql服务
server nginx start
server php5-fpm start
server mysql start
9.测试
访问你的ip地址&#xff0c;如果可以访问到phpinfo的信息&#xff0c;那么 恭喜你你已经完成了。
服务器配置&#xff1a;
1.添加apt源
vi /etc/apt/sources.list
添加&#xff1a;
deb http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
deb http://ppa.launchpad.net/nginx/stable/ubuntu lucid main
deb http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main
2. 最后一行为nginx的ppa源&#xff0c;需要添加key,执行下面命令
apt-key adv --keyserver keyserver.Ubuntu.com --recv-keys C300EE8C
3.更新apt源
apt-get update
4.安装nginx&#43;php&#43;mysql
apt-get install nginx php5-common php5-dev php5-cgi php5-fpm php-apc php5-mysql php5-curl php5-gd php5-idn php-pear php5-mcrypt php5-memcache php5-ming php5-recode php5-tidy php5-xmlrpc php5-xsl mysql-server
server nginx start
访问你的ip看能不能看到nginx的欢迎界面&#xff0c;如果可以看到请接着往下做。如果不能访问那么请检查&#xff0c;等可以访问了再往下做
5.配置nginx
vi /etc/nginx/sites-enabled/default
修改
root /var/share/nginx/nginx-default;
为
root /var/www/
修改
index index.html index.htm;
为
index index.php index.html index.htm;
修改
# location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# include fastcgi_params;
#}
为
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
6.创建phpinfo测试文件
cat >/var/www/index.php<
phpinfo();
?>
EOF
8.启动nginx&#xff0c;php&#xff0c;mysql服务
server nginx start
server php5-fpm start
server mysql start
9.测试
访问你的ip地址&#xff0c;如果可以访问到phpinfo的信息&#xff0c;那么 恭喜你你已经完成了。