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.
    
  • 相关阅读:
    Dubbo 安装监控中心
    Docker安装RabbitMQ
    Python 3 字符串转MD5形式
    Ubuntu 安装jupyter notebook
    设计模式学习-合成模式
    ubuntu 下安装jupyter
    使用物理备份恢复数据库
    matplotlib 中的subplot的用法
    pandas中关于DataFrame的groupby方法,如何取出分组的ID(行名称)和ID对应的个数
    java编程中'为了性能'一些尽量做到的地方
  • 原文地址:https://www.cnblogs.com/ay-a/p/11828739.html
Copyright © 2011-2022 走看看