linux(centos7)搭建thinkphp5环境 ngi
为什么要写这篇博客呢?最近有一个自己练手的项目需要搭建到服务器上,自己只是在本机搭建过开发环境,对于一脸懵逼的自己,看了很多博客,什么安装的版本不相同导致安装方法不一样,而且查看的资料不准确,什么看别人的资料就感觉实在完成任务一样,很难受,在加上一段时间以来的压抑的工作现状。再加上自己这种热情,喜欢乐于助人的精神,So...... 我是一个好人。
一:安装nginx
1.登录服务器
ssh root@172.96.03.90 -p 27393


2.创建下载安装包的目录 和安装目录
mkdir /usr/local/nginx

3.下载nginx安装包 以及依赖的包
yum -y install gcc gcc-c++ make

wget http://nginx.org/download/nginx-1.14.0.tar.gz
提示我们 这个 :


解压缩到download文件夹下
tar -zxvf nginx-1.14.0.tar.gz

4. 运行./configure --prefix=/usr/local/nginx 检测程序文件。(--prefix=/usr/local/nginx 指定安装路径)

其实还需要 这些的
yum install -y gcc gcc-c++ pcre pcre-devel openssl openssl-devel zlib


漫长的等待。。。。。

接着在make install


启动nginx


设置
firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent永久生效,没有此参数重启后失效)

FirewallD is not running

因为我自己开启了防火墙那个端口应该给屏蔽掉了。
第二天上班 天气真好啊 哈哈哈 我们继续

创建nginx启动脚本
vi /etc/init.d/nginx
插入下面内容:
#! /bin/bash
# chkconfig: - 85 15
PATH=/usr/local/nginx
DESC="nginx daemon"
NAME=nginx
DAEMON=$PATH/sbin/$NAME
CONFIGFILE=$PATH/conf/$NAME.conf
PIDFILE=$PATH/logs/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
set -e
[ -x "$DAEMON" ] || exit 0
do_start() {
$DAEMON -c $CONFIGFILE || echo -n "nginx already running"
}
do_stop() {
$DAEMON -s stop || echo -n "nginx not running"
}
do_reload() {
$DAEMON -s reload || echo -n "nginx can't reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
do_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
do_stop
echo "."
;;
reload|graceful)
echo -n "Reloading $DESC configuration..."
do_reload
echo "."
;;
restart)
echo -n "Restarting $DESC: $NAME"
do_stop
do_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
exit 3
;;
esac
exit 0
设置执行权限
chmod a+x /etc/init.d/nginx
注册成服务
chkconfig --add nginx
设置开机启动
chkconfig nginx on


下面我们来安装mysql
这个地方有一篇博客 https://www.cnblogs.com/fangts/p/8994851.html
其中有问题存在 :
1.第4步 的命令 应该是
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
tar xzvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
cp -R mysql-5.7.24-linux-glibc2.12-x86_64/. /usr/local/mysql
最后一条命令将解压出来的文件夹下面的所有内容 复制到 /usr /local/mysql下面 不然接下来的操作都错了。
因为下载比较慢 所以 先下载到本地 然后在 上传到服务器上面
scp /Users/sunriseos/Desktop/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz root@94.191.1.106:/usr/local/download/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
下面安装php
链接 https://www.cnblogs.com/zoulongbin/p/6379272.html
从第十点开始安装