一名宅。 - LNMP
type: channel
link: https://zhaiyiming.com/tag/LNMP/
items: 阿里云 CentOS 7.2 PHP7 LNMP配置

阿里云 CentOS 7.2 PHP7 LNMP配置
type: item
date: 2017-04-05T11:25:00+08:00
description: 更新系统软件 yum update 安装编译工具 yum install gcc automake autoconf libtool gcc-c++ 安装服务端程序（二选一） (a) nginx 安装nginx源 yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm 安装nginx yum install nginx 启动nginx service nginx start 成功显示: Redirecting to /bin/systemctl start nginx.service (b) tengine 安装编译工具 yum install gcc-c++ yum -y install pcre pcre-devel yum -y install zlib zlib-devel yum -y install openssl openssl-devel 下载 tengine 并编译安装 wget http://tengine.taobao.org/download/tengine-2.2.0.tar.gz tar -zxvf tengine-2.2.0.tar.gz ./configure \ --prefix=/usr/local/nginx \ --sbin-path=/usr/local/nginx/sbin/nginx \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --pid-path=/var/run/nginx.pid make && make install 测试运行 tengine /usr/local/nginx/sbin/nginx 设置为开机自启动 cd /lib/systemd/system && vim nginx.service [Unit] Description=The nginx HTTP and reverse proxy server After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/run/nginx.pid ExecStartPre=/usr/local/nginx/sbin/nginx -t ExecStart=/usr/local/nginx/sbin/nginx -c /etc/nginx/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target 修改权限并设置开机启动 chmod 745 nginx.service systemctl enable nginx.service 安装MySQL5.7.* 安装mysql源 yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm 安装mysql yum install mysql-community-server 确认一下mysql的版本，有时可能会提示mysql5.6 安装mysql的开发包，以后会有用 yum install mysql-community-devel 启动mysql service mysqld start 成功返回 Redirecting to /bin/systemctl start mysqld.service 查看mysql启动状态 service mysqld status 出现pid证明启动成功 获取mysql默认生成的密码 grep 'temporary password' /var/log/mysqld.log 2017-02-10T14:59:42.328736Z 1 [Note] A temporary password is generated for root@localhost: s/giN9Vo>L9h 冒号后面的都是密码(没有空格) 复制就好 换成自己的密码 mysql -u root -p Enter password: 输入上面复制的密码 更…