Ubuntu 16.04使用源安装Nginx+PHP5.6+MySQL5.6
在Ubuntu 16.04中使用源安装Nginx+PHP5.6+MySQL5.6的方法。
安装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 documentroot 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的密码,安装好后:
相关推荐
yserver 2020-08-15
nginxs 2020-11-14
Guanjs0 2020-11-13
小木兮子 2020-11-11
yserver 2020-11-11
ssihc0 2020-11-11
windle 2020-11-10
HanksWang 2020-11-10
liuchen0 2020-11-10
Freshairx 2020-11-10
ccschan 2020-11-10
liwf 2020-11-10
Guanjs0 2020-11-09
AderStep 2020-11-09
zrtlin 2020-11-09
mqfcu 2020-11-10