平台:debian 7 x86_64
1,安装mysql源
wget http://dev.mysql.com/get/mysql-apt-config_0.6.0-1_all.deb
dpkg -i mysql-apt-config_0.6.0-1_all.deb
按需求选mysql6或7,apply
2,安装nginx源
echo "deb http://nginx.org/packages/debian/ wheezy nginx
deb-src http://nginx.org/packages/debian/ wheezy nginx" >> /etc/apt/sources.list
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
rm nginx_signing.key
3,更新缓存
apt-get update
4,安装nginx
apt-get install -y nginx-full build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev openssl libssl-dev
5,安装mysql
apt-get install -y mysql-server (输入root密码)
授权root账号有远程访问权限
mysql -u root -p
grant all privileges on *.* to root@'%' identified by "hello";
flush privileges;
exit
6,安装php
apt-get install -y php5 php5-fpm php5-gd php5-common php5-cli php5-intl php5-sqlite php5-mcrypt php5-mysql php5-curl php5-memcache memcached php5-xcache
7,简单配置
vi /etc/nginx/sites-available/default
server段修改如下
root /var/www/html;
index index.html index.php index.htm;
#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;
# }
8,建立网站目录并授权
mkdir -p /var/www/html
chown -R www-data:www-data /var/www/html
9测试
echo "<?php phpinfo(); ?>" > /var/www/html/index.php
service nginx restart
浏览器输入http://yourserverip
若看到phpinfo信息页就成了