zoukankan      html  css  js  c++  java
  • Centos 安装Nginx

    一 安装编译工具及库文件

    yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel
    

    二 安装 PCRE (支持Rewrite 功能)

    # 下载地址: http://www.pcre.org
    wget ftp://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz # 下载,我用的8.43版本
    tar -zxvf  pcre-8.43.tar.gz #解压
    cd pcre-8.43/  #进入源码目录
    ./configure    #配置
    make  #编译
    make install #安装
    
    

    三 安装nginx

    #下载地址: http://nginx.org/
    wget http://nginx.org/download/nginx-1.17.5.tar.gz  # 下载,我用的1.17.5版本
    tar -zxvf nginx-1.17.5.tar.gz   #解压
    cd nginx-1.17.5/  #进入源码目录
     ./configure --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/opt/pcre-8.43   # /opt/pcre-8.43是 PCRE源码目录  /opt/nginx 是nginx安装目录
    make  #编译
    make install #安装
    

    四 验证安装

    安装完成后进入 /opt/nginx目录,nginx可执行程序在sbin`目录下,进入sbin目录验证安装,

    [root@localhost nginx]# ls
    client_body_temp  conf  fastcgi_temp  html  logs  proxy_temp  sbin  scgi_temp  uwsgi_temp
    [root@localhost nginx]# cd sbin/
    [root@localhost sbin]# ls
    nginx
    [root@localhost sbin]# ./nginx  -v   查看nginx
    nginx version: nginx/1.17.5
    [root@localhost sbin]# ./nginx  -t  # 检查配置文件
    nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /opt/nginx/conf/nginx.conf test is successful
    [root@localhost sbin]# ./nginx  # 启动nginx 
    

    启动nginx 后再浏览器输入电脑ip地址,回车,如果打印出以下信息则证明安装成功。

    Welcome to nginx!
    If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
    
    For online documentation and support please refer to nginx.org.
    Commercial support is available at nginx.com.
    
    Thank you for using nginx.
    
  • 相关阅读:
    声明、定义本质的区别:有无内存的分配
    typedef 与 define 的区别
    Linux内核中链表的学习
    C语言数据类型的转换
    状态机
    170311php添加留言页面
    170314网络编程之TCP聊天窗口
    php课堂2简单作业+文件上传之案例
    php案例2——用户列表页
    学生管理系统
  • 原文地址:https://www.cnblogs.com/ay-a/p/11828739.html
Copyright © 2011-2022 走看看