安装mysql
sudo apt-get install mysql-server
安装nginx
sudo apt-get install nginx
安装php5
sudo apt-get install php5-fpm
sudo /etc/init.d/nginx start 启动服务,在浏览器输入http://localhost,成功返回页面则继续下面配置。失败的则查看日志。
service nginx status 可以查看服务状态。
日志放置在 /var/log/nginx 里面。
cat /var/log/nginx/error.log 查看日志
配置:
gedit /etc/nginx/sites-available/default
server {
listen 80;
# listen [::]:80 default_server ipv6only=on;
root /var/www/;(网站目录)
index index.html index.htm index.php; (加上index.php)
去掉下面这段话的相应注释,效果如下:
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
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;
}
安装扩展:
数据库扩展:sudo apt-get install php5-mysql
curl扩展:sudo apt-get install php5-curl