一、安装mysql
apt install mysql-server
阿里云如果出现 unable to locate package mysql-server
先执行 apt-get update
设置远程访问
mysql -u root -p
grant all on . to root@’%’ identified by ‘password’; // password改为真实密码
flush privileges;
exit
编辑mysql配置文件,注释掉“bind-address = 127.0.0.1”
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
#bind-address = 127.0.0.1
阿里云需要增加3306端口开放
重启服务
service mysql restart
二、安装apache
apache 2.4
安装apache
apt install apache2
配置apache服务器站点(如有需要)
mytaibo.conf
ServerAdmin 1037944412@qq.com
DocumentRoot /var/www/src
ServerName mytaibo.com
ServerAlias www.mytaibo.com
DirectoryIndex index.php
ErrorLog /var/log/apache2/error.log
配置虚拟主机在site-avilable添加虚拟主机配置即可
cd /etc/apache2/site-avilable
vi mytaibov2.conf
service apache2 restart
三、php版本回溯(7->5.6)
ubuntu16.04默认支持php7改为php5.6
apt purge dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
add-apt-repository ppa:ondrej/php
// 若上一步执行失败,按提示可能需要apt install software-properties-common
sudo apt update
安装php5.6
apt install php5.6
安装支持库
apt install libapache2-mod-php5.6 php5.6-curl php5.6-xml php5.6-mysql php5.6-gd php5.6-zip php5.6-mbstring
重启生效
service apache2 restart
源码
上传源码至/var/www/下对应的站点目录
源码根目录下创建子目录并设置权限
mkdir Runtime
mkdir Uploads
mkdir Uploads/icon
mkdir Uploads/xinwen
mkdir Uploads/admin
mkdir Uploads/homeservice
mkdir Uploads/mall/products/images
mkdir TempFile
mkdir Speech
设置目录用户和组
sudo chown -R www-data:www-data /var/www
**
授权
获取机器码 http://www.域名.com/index.php/License/udid
根据机器码向公司申请文件license.dat,上传至服务器 /var/license/ 目录下