安装Nginx
1、首先添加nginx_signing.key(必须,否则出错)
$ wget http://nginx.org/keys/nginx_signing.key
$ sudo apt-key add nginx_signing.key
2、添加]Nginx](http://nginx.org/)官方提供的源
$ echo "deb http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list
$ echo "deb-src http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list
3、更新源并安装Nginx
$ sudo apt-get update
$ sudo apt-get install nginx
4、安装Nginx完成后可查看版本号,输入
$ /usr/sbin/nginx -v
安装PHP5.6
1、添加PPA
$ sudo apt-get install python-software-properties software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
2、安装PHP5.6以及所需的一些扩展
$ sudo apt-get install php5.6-fpm php5.6-mysql php5.6-common php5.6-curl php5.6-cli php5.6-mcrypt php5.6-mbstring php5.6-dom
3、配置PHP5.6
打开php.ini
配置文件:
$ sudo vim /etc/php/5.6/fpm/php.ini
找到cgi.fix_pathinfo
选项,去掉注释;,然后将值设置为0
:
cgi.fix_pathinfo = 0;
display_errors = On
location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php5.6-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
安装MySQL
安装mysql
$ sudo apt-get install mysql-server-5.6 mysql-client-5.6
途中会提示设置MySQL的密码,安装好后:
$ mysql -uroot -p
然后输入刚刚设置的密码,能成功进入即成功安装。
保证不会出现502错误