阿里云centOS7.2+LAMP环境搭建

一.阿里云环境搭建参考网址:
参考网址1:http://blog.csdn.net/fireblue1990/article/details/54603496
参考网址2:http://www.linuxidc.com/Linux/2017-02/141170.htm
以上我是使用第二个教程的搭建,具体可以点击进去查看,我这边记录环境搭建可能出现问题,避免大家再走坑。
问题一:

  1. 有个地方配置PidFile路径,先不要配置,回头其他也配置完再来设置
  2. 设置PidFile路径vim /etc/httpd/httpd.conf
  3. 在配置文件最后添加以下内容: PidFile”/var/run/httpd.pid”

问题二:安装mysql的时候,以下几步不要按网址里面的,替换成以下的得路径

  1. 将/usr/local/mysql/bin/mysqld –initialize-insecure –datadir=/usr/local/mysql/data/–user=mysql替换成/usr/local/mysql/bin/mysqld –initialize-insecure –user=mysql –datadir=/usr/local/mysql/data/

问题三:mysql报错解决的网址 http://www.bubuko.com/infodetail-1942640.html

  1. 原操作系统存在mariadb包,启动时报错如下:2017-02-13T03:33:09.721333Z mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log‘2017-02-13T03:33:09.748968Z mysqld_safe error: log-error set to ‘/var/log/mariadb/mariadb.log‘, however file don‘t exists. Create writable for user ‘mysql‘.
  2. 解决方法:[root@localhost mysql]# rpm -e –nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64

二.阿里云站点配置

  • 站点:cd /usr/local/apache/htdocs/
  • 配置文件:vim /etc/httpd/httpd.conf
  • 取消配置中的/etc/httpd/extra/httpd-vhosts.conf前面的#号,才能配置更多虚拟主机
  • 进入vim /etc/httpd/extra/httpd-vhosts.conf
  • 示例
    •     ServerAdmin webmaster@dummy-host.example.com
    •     DocumentRoot “/usr/local/apache/docs/dummy-host.example.com”
    •     ServerName dummy-host.example.com
    •     ServerAlias www.dummy-host.example.com
    •     ErrorLog “logs/dummy-host.example.com-error_log”
    •     CustomLog “logs/dummy-host.example.com-access_log” common
  • 重启apache服务
    • /usr/local/apache/bin/apachectl restart