首页 > 代码库 > debian7.7快速构建lamp和lnmp环境

debian7.7快速构建lamp和lnmp环境

debian快速构建lamp和lnmp环境

操作系统环境:debian7.7 


安装lamp环境


apt-get install apache2 mysql-server php5 php-pear php5-mysql php5-gd php5-curl php5-common php5-dev php5-xcache -y 


echo "<?php phpinfo(); ?>" > /var/www/index.php


root@debian:~# curl -I http://192.168.5.44/index.php

HTTP/1.1 200 OK

Date: Thu, 06 Nov 2014 08:57:05 GMT

Server: Apache/2.2.22 (Debian)

X-Powered-By: PHP/5.4.34-0+deb7u1

Vary: Accept-Encoding

Content-Type: text/html



安装lnmp环境


apt-get install nginx mysql-server php5 php5-fpm php-pear php5-mysql php5-gd php5-curl php5-common php5-dev php5-xcache -y



echo "<?php phpinfo(); ?>" >/usr/share/nginx/www/index.php


#config nginx 


vim /etc/nginx/sites-available/default 


location ~ \.php$ {

fastcgi_split_path_info ^(.+\.php)(/.+)$;

## NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

#

## With php5-cgi alone:

fastcgi_pass 127.0.0.1:9000;

## With php5-fpm:

#fastcgi_pass unix:/var/run/php5-fpm.sock;

fastcgi_index index.php;

include fastcgi_params;

}



#config php-fpm 

vim /etc/php5/fpm/pool.d/www.conf


#listen = /var/run/php5-fpm.sock

listen = 127.0.0.1:9000



#restart nginx php-fpm 


/etc/init.d/nginx restart

/etc/init.d/php5-fpm restart



root@debian:~# curl -I http://192.168.5.44/index.php

HTTP/1.1 200 OK

Server: nginx/1.2.1

Date: Thu, 06 Nov 2014 12:11:44 GMT

Content-Type: text/html

Connection: keep-alive

X-Powered-By: PHP/5.4.34-0+deb7u1







本文出自 “linux学习记录” 博客,请务必保留此出处http://micheng.blog.51cto.com/1463868/1573834

debian7.7快速构建lamp和lnmp环境