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
<!DOCTYPE html>

Welcome to nginx!

body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}

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开启造成的。

Nginx源代码安装的更多相关文章

  1. Building nginx from Sources(从源代码安装nginx)

    Building nginx from Sources(从源代码安装nginx) The build is configured using the configure command.  安装用配置 ...

  2. CentOS 7 源代码安装Nginx

    本篇简要介绍CentOS 7 源代码安装Nginx. Preface # yum install epel-release -y # yum group install "Developme ...

  3. 在Centos7下源代码安装配置Nginx

    1.安装前准备开发环境安装pcre开发包:yum install -y pcre-devel 安装编译源码所需的工具和库:yum install gcc gcc-c++ ncurses-devel p ...

  4. nginx笔记----安装

    nginx的安装 ./configure make && make install (一)准备条件: 1.GCC---gun编译器集合 Nginx是一个由C语言编写的程序,因此首先需要 ...

  5. Ubuntu中Nginx的安装与配置

    原文地址:http://www.cnblogs.com/languoliang/archive/2013/04/01/nginx.html 1.Nginx介绍 Nginx是一个非常轻量级的HTTP服务 ...

  6. Nginx 在安装入门

    1.首先需要安装必要的库,PCRE,zlib sudo apt-get install libpcre3 libpcre3-dev 假设找不到文件的话就下载源文件进行安装. 2.解压下载的nginx源 ...

  7. nginx简单安装设置

    1.Nginx ("engine x") 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器.Nginx是由Igor Sysoev为俄罗斯访问量第二 ...

  8. nginx 的安装、启动、停止与重启

    一.nginx 基本介绍 1.Nginx 是单进程单线程模型,也就是启动的工作进程只有一个线程响应客户端请求,而 apache 可以在一个进程内启动多个线程响应客户端请求.所以 nginx 的内存占用 ...

  9. nginx笔记 安装nginx 配置 反向代理 多虚拟主机

    1,检测linux上是否 通过yum安装了nginxrpm   -qi  nginx 2.安装nginx之前的依赖包yum install gcc patch libffi-devel python- ...

随机推荐

  1. HP Jack介绍

    转载:https://www.cnblogs.com/Peter-Chen/p/3999212.html 目前市场上耳机分为4环耳机(图1所示,iphone型)和3环耳机(图2所示).4环耳机称为he ...

  2. django 完整日志配置

    django中的log需要在settings.py中配置 import time cur_path = os.path.dirname(os.path.realpath(__file__)) # lo ...

  3. Python+OpenCV图像处理(十六)—— 轮廓发现

    简介:轮廓发现是基于图像边缘提取的基础寻找对象轮廓的方法,所以边缘提取的阈值选定会影响最终轮廓发现结果. 代码如下: import cv2 as cv import numpy as np def c ...

  4. python爬虫——跟踪登录过程以及意外的发现(4)

    新浪微博的消息还是很多的,值得弄个账号去爬.不过都有账号了,还需要特意再搞一个吗? 直接上去跟踪.分别使用www和wap端登录: wap端相对简单,form表单都没有用到前面传的数据.但是我看到表单时 ...

  5. Codeforces 932G Palindrome Partition - 回文树 - 动态规划

    题目传送门 通往???的传送点 通往神秘地带的传送点 通往未知地带的传送点 题目大意 给定一个串$s$,要求将$s$划分为$t_{1}t_{2}\cdots t_{k}$,其中$2\mid k$,且$ ...

  6. libcurl返回常见错误码

    转载:https://blog.csdn.net/kenkao/article/details/46875571 转载:http://www.cnblogs.com/wainiwann/p/34929 ...

  7. Python文档记录

    Beautiful Soup 4.2.0 文档 Python3网络爬虫开发实战 Python库-requests 文档 Selenium with Python中文翻译文档 http://www.te ...

  8. POI使用记录

    POI CellType类型 CellType  类型  值 CELL_TYPE_NUMERIC  数值型  0 CELL_TYPE_STRING  字符串型 1 CELL_TYPE_FORMULA ...

  9. C#树类型及其遍历

    最近有个项目不仅需要取部门的层级关系,还要处理不规则的关系(移除某个部门),只有树结构才能实现相关遍历和操作. 涉及到的知识点:泛型.递归.数据结构 既然研究树类型就先来看下树的定义: 一棵树(tre ...

  10. 一键清空Form表单数据

    今天在工作项目调试bug当中,遇到这样的需求:页面上的数据太多,一个一个清空太繁琐,所以就采用全部清空的写法: $(':input','#myform').not(':button, :submit, ...