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.
    
  • 相关阅读:
    HDU1496(巧妙hash)
    SPOJ(后缀数组求不同子串个数)
    django-admin自定义登录
    Bootstrap实现的页面
    ImageMagick来处理图片,缩放,调整高度等操作
    xlrd,xlwt操作Excel实例
    匹配图片修改图片名称
    python 的两个模块xlwt,xlrd,写入和读取Excel数据
    Excel常见操作,重复数据,去除数据关联
    Excel数据常用操作,vlookup,text,trim,数据格式导致出错
  • 原文地址:https://www.cnblogs.com/ay-a/p/11828739.html
Copyright © 2011-2022 走看看