zoukankan      html  css  js  c++  java
  • Nginx源代码安装

    1.确认系统平台及版本
    [root@Trial html]# uname -r
    2.6.32-696.6.3.el6.x86_64
    [root@Trial html]# cat /etc/redhat-release
    CentOS release 6.9 (Final)

    2.安装Niginx所需要的pcre库(使Nginx支持具备URL重写功能的rewrite模块。)

    [root@Trial ~]# yum -y install pcre.x86_64 pcre-devel.x86_64
    [root@Trial ~]# rpm -q pcre.x86_64 pcre-devel.x86_64

    3.安装基础依赖包openssl、openssl-devel
    [root@Trial ~]# yum -y install openssl openssl-devel
    [root@Trial ~]# rpm -q openssl openssl-devel

    4.下载nginx1.6.3.tar.gz包
    [kennminn@Trial ~]$ mkdir -p /home/kennminn/tools
    [kennminn@Trial tools]$ cd /home/kennminn/tools
    [kennminn@Trial tools]$ wget -q http://nginx.org/download/nginx-1.6.3.tar.gz
    [kennminn@Trial tools]$ tar -tvf nginx-1.6.3.tar.gz #查看一下nginx的目录结构
    [kennminn@Trial tools]$ tar -xvf nginx-1.6.3.tar.gz
    [kennminn@Trial tools]$ cd nginx-1.6.3
    [kennminn@Trial nginx-1.6.3]$ ls
    CHANGES LICENSE auto configure html src
    CHANGES.ru README conf contrib man

    5.新建nginx的安装目录以及nginx用户(Root用户权限)
    [root@Trial ~]# mkdir -p /application/nginx-1.6.3
    [root@Trial ~]# useradd nginx -M -s /sbin/nologin #-M选项的作用是不用生成家目录,因为nginx用户不用登录系统

    6.安装Nginx
    [root@Trial ~]# cd /home/kennminn/tools/nginx-1.6.3
    [root@Trial nginx-1.6.3]# ./configure --user=nginx --group=nginx --prefix=/application/nginx-1.6.3/ --with-http_stub_status_module --with-http_ssl_module
    [root@Trial nginx-1.6.3]# make
    [root@Trial nginx-1.6.3]# make install
    [root@Trial nginx-1.6.3]# ln -s /application/nginx-1.6.3/ /application/nginx
    [root@Trial nginx-1.6.3]# ll /application/
    total 4
    lrwxrwxrwx. 1 root root 25 Jul 25 11:55 nginx -> /application/nginx-1.6.3//
    drwxr-xr-x. 6 root root 4096 Jul 25 11:54 nginx-1.6.3/

    7.启动Nginx进程
    [root@Trial nginx]# /application/nginx/sbin/nginx

    8.验证
    [root@Trial nginx]# lsof -i :80
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    nginx 7656 root 6u IPv4 29052 0t0 TCP *:http (LISTEN)
    nginx 7657 nginx 6u IPv4 29052 0t0 TCP *:http (LISTEN)

    [root@Trial nginx]# netstat -tlnup |grep nginx
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7656/nginx

    [root@Trial nginx]# wget 127.0.0.1
    --2017-07-25 12:00:57-- http://127.0.0.1/
    Connecting to 127.0.0.1:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 612 [text/html]
    Saving to: “index.html”

    100%[=========================================>] 612 --.-K/s in 0s

    [root@Trial nginx]# curl 127.0.0.1

    Welcome to nginx!

    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.

    这些都说明Nginx服务已经正常的启动了。

    问题1 本地可以正常访问,远程无法访问
    原因:防火墙开启了,关闭防火墙或者在防火墙增加访问80的端口的策略。也有可能是selinux开启造成的。

  • 相关阅读:
    numpy函数:[6]arange()详解
    python中的list和array的不同之处
    python 矩阵转置transpose
    PowerDesigner(一)-PowerDesigner概述(系统分析与建模)
    MDX中Filter 与Exist的区别
    SQL Server 2016 —— 聚集列存储索引的功能增强
    SQL Server 2016:内存列存储索引
    PXE
    setjmp
    skb head/data/tail/end/介绍
  • 原文地址:https://www.cnblogs.com/minn/p/7233863.html
Copyright © 2011-2022 走看看