更换 apt-get 源
cd /etc/apt/sources.list
内容全部更换为:
deb http://ftp.debian.org/debian jessie main contrib non-free
deb http://ftp.debian.org/debian jessie-updates main contrib non-free
deb http://security.debian.org jessie/updates main contrib non-free
deb http://packages.dotdeb.org jessie all
deb http://ftp.debian.org/debian jessie-backports mai
deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all
运行升级命令来确保我们的系统组件各方面都是最新的。
apt-get update
apt-get upgrade --show-upgraded
一、安装Apache Web服务器的当前版本(在2.x系列),执行命令如下:
apt-get install apache2
安装好后开服务
service apache2 start
展示页面为:
二、开始安装PHP7.0
缓存搜索php7
apt-cache search php7 | grep php7
安装php
apt-get install php7.0
完成之后输入
php -v
会看到已安装的版本PHP7.0
这个时候,Apache运行则还是无法编译php代码的,会出现原文输出的效果,就像文本格式一样,
进入 /etc/apache2/sites-available/
查找到:
SSLOptions +StdEnvVars
修改为:
SSLOptions +StdEnvVars
重启apache
service apache2 restart
完美解决了!!!
三、安装MYSQL
apt-get install mysql-server -y
输入自己数据库的密码
之后就完成了!
数据库安全配置
mysql_secure_installation
进入数据库
mysql -u root -p '你的密码'
grant all privileges on *.* to 'root'@'%' identified by '你的账户密码' with grant option;---这个主要用户外网连接数据库,如果你不需要的话,就不用设置了
flush privileges---操作生效
然后添加用户权限---mysql中
grant all privileges on *.* to 'root'@'%' identified by '密码' with grant option;---------进入数据库的时候已经设置了,这里就不需要再次设置了!
最后一步:
关于外网访问数据库连接(创建自己的数据库之后再操作,否则可能会影响数据库的命令创建)
进入 /etc/mysql/my.conf
查找bind-address的配置, 修改前为:bind-address = 127.0.0.1
修改后为:bind-address = 0.0.0.0
评论/回复