Ubuntu安装Nginx+PHP7.0.4+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完成后可查看版本号,输入

nginx -v

安装PHP7

1、添加PPA

sudo apt-get install python-software-properties software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update
2、安装PHP7以及所需的一些扩展

sudo apt-get install php7.0-fpm php7.0-mysql php7.0-common php7.0-curl php7.0-cli php7.0-mcrypt php7.0-mbstring php7.0-dom
3、配置PHP7

打开php.ini配置文件:

sudo vim /etc/php/7.0/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/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

安装MySQL

安装mysql

sudo apt-get install mysql-server-5.6 mysql-client-5.6

安装mysql5.7:
sudo apt-get update
sudo apt-get install mysql-server
sudo mysql_secure_installation
sudo mysql_install_db

途中会提示设置MySQL的密码,安装好后:

mysql -uroot -p

然后输入刚刚设置的密码,能成功进入即成功安装。

0
如无特殊说明,文章均为本站原创,转载请注明出处

该文章由 发布

这货来去如风,什么鬼都没留下!!!
发表我的评论

Hi,请填写昵称和邮箱!

取消评论
代码 贴图 加粗 链接 删除线 签到