• 在linux(centos)系统安装nginx教程


    最近在切换服务器操作系统,简单记录一下

    一、安装nginx需要如下环境 

    1、gcc 

    编译依赖gcc环境,如果没有gcc环境,需要安装gcc

    yum install gcc-c++ 

     2、PCRE

    PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库。nginx的http模块使用pcre来解析正则表达式,所以需要在linux上安装pcre库。

    yum install -y pcre pcre-devel

    3、zlib 

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

    yum install -y zlib zlib-devel

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

    yum install -y openssl openssl-devel

     二、编译安装

    将nginx-1.12.2.tar.gz拷贝至linux服务器。

    解压: 
    tar -zxvf nginx-1.12.2.tar.gz 
    cd nginx-1.12.2

    执行如下命令

     

    开始安装和 编译

    make && make install

    查看安装目录

    whereis nginx

    、启动nginx

    去安装目录下执行./nginx

    启动

    cd /usr/local/nginx/sbin/
    ./nginx

    查看nginx运行进程

    ps -aux | grep nginx

    其中13827为Nginx的主进程id,13828为Nginx的工作进程id

     四、启动nginx

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

    五、 Nginx测试

    访问对应安装Nginx的linux的ip,出现如下界面即安装成功。 

  • 相关阅读:
    C# send mail with outlook and word mailmerge
    The ‘Microsoft.ACE.OLEDB.12.0′ provider is not registered on the local machine. (System.Data)
    显示数据库中所有表的记录数
    Transaction Log Truncation
    To change the sharepoint CA port
    sharepoint One-Time Passwords (windows basic authentication)
    Multi-Device Hybrid Apps (Preview)
    0ffice365 Calendar API
    angular service/directive
    MySql安装图解
  • 原文地址:https://www.cnblogs.com/chengxs/p/9831456.html
Copyright © 2020-2023  润新知