zoukankan      html  css  js  c++  java
  • CentOS 7.4 + nginx + php + mysql + phpmyadmin环境搭建,详细操作

    1、gcc安装

    安装 nginx 需要先将官网下载的源码进行编译,编译依赖 gcc 环境,如果没有 gcc 环境,则需要安装:

    yum install gcc-c++

    二. PCRE pcre-devel 安装
    PCRE(Perl Compatible Regular Expressions) 是一个Perl库,包括 perl 兼容的正则表达式库。nginx 的 http 模块使用 pcre 来解析正则表达式,所以需要在 linux 上安装 pcre 库,pcre-devel 是使用 pcre 开发的一个二次开发库。nginx也需要此库。命令:

    yum install -y pcre pcre-devel

    三. zlib 安装
    zlib 库提供了很多种压缩和解压缩的方式, nginx 使用 zlib 对 http 包的内容进行 gzip ,所以需要在 Centos 上安装 zlib 库。

    yum install -y zlib zlib-devel

    四. OpenSSL 安装
    OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及 SSL 协议,并提供丰富的应用程序供测试或其它目的使用。
    nginx 不仅支持 http 协议,还支持 https(即在ssl协议上传输http),所以需要在 Centos 安装 OpenSSL 库。

    yum install -y openssl openssl-devel

    官网下载

    1.直接下载.tar.gz安装包,地址:https://nginx.org/en/download.html

    解压

    依然是直接命令:

    tar -zxvf nginx-1.10.1.tar.gz
    cd nginx-1.10.1

    配置

    其实在 nginx-1.10.1 版本中你就不需要去配置相关东西,默认就可以了。当然,如果你要自己配置目录也是可以的。
    1.使用默认配置

    ./configure

    编译安装

    make
    make install

    查找安装路径:

    whereis nginx

    nginx-whereis.png

    启动、停止nginx

    cd /usr/local/nginx/sbin/
    ./nginx 
    ./nginx -s stop
    ./nginx -s quit
    ./nginx -s reload

    ./nginx -s quit:此方式停止步骤是待nginx进程处理任务完毕进行停止。
    ./nginx -s stop:此方式相当于先查出nginx进程id再使用kill命令强制杀掉进程。

    查询nginx进程:

    ps aux|grep nginx

    重启 nginx

    1.先停止再启动(推荐):
    对 nginx 进行重启相当于先停止再启动,即先执行停止命令再执行启动命令。如下:

    ./nginx -s quit
    ./nginx

    2.重新加载配置文件:
    当 ngin x的配置文件 nginx.conf 修改后,要想让配置生效需要重启 nginx,使用-s reload不用先停止 ngin x再启动 nginx 即可将配置信息在 nginx 中生效,如下:
    ./nginx -s reload

    启动成功后,在浏览器可以看到这样的页面:

    nginx-welcome.png

    开机自启动

    即在rc.local增加启动代码就可以了。

    vi /etc/rc.local

    增加一行 /usr/local/nginx/sbin/nginx
    设置执行权限:

    chmod 755 rc.local

    到这里,nginx就安装完毕了,启动、停止、重启操作也都完成了,当然,你也可以添加为系统服务,我这里就不在演示了。


     

    1、安装nginx-1.12.2

    2、安装php-fpm

    # rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    # yum list php*

    可以发现里面有很多版本的php
    选择对应的安装的包
    # yum  -y  install php56w php56w-fpm php56w-mysql php56w-gd libjpeg* php56w-ldap php56w-odbc php56w-pear php56w-xml php56w-xmlrpc php56w-mbstring php56w-bcmath
    

    mysql

    https://blog.csdn.net/cjh365047871/article/details/78811385

    3. 下载安装程序 
    wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm 
    wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.21-1.rhel5.x86_64.rpm 
    wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.21-1.rhel5.x86_64.rpm 

  • 相关阅读:
    Eventbus的功能
    Linux下xz与tar的区别
    IntelliJ IDEA出现:This file is indented with tabs instead of 4 spaces的问题解决
    IntelliJ IDEA设置properties文件显示中文
    oh-my-zsh官方教程
    Vim出现:_arguments:450: _vim_files: function definition file not found的问题解决
    Ubuntu 16.04下安装zsh和oh-my-zsh
    zsh与oh-my-zsh是什么
    Mac安装IntelliJ IDEA时快捷键冲突设置
    IntelliJ IDEA删除项目
  • 原文地址:https://www.cnblogs.com/wowchky/p/9116877.html
Copyright © 2011-2022 走看看