需求描述:

  记录在linux平台,nginx安装的过程.

环境描述:

  操作系统:Red Hat Enterprise Linux Server release 6.6 (Santiago)

  操作内核版本:2.6.32-504.el6.x86_64

  nginx版本:nginx-1.14.0

安装过程:

1.下载nginx的源码包

软件分享(百度云):

https://pan.baidu.com/s/1305ocsP2gHXdLR6PHmhDBA

2.将nginx源码包上传到服务器上

[root@testvm software]# pwd
/opt/software
[root@testvm software]# ls -ltr
total
-rw-r--r--. root root Apr : nginx-1.14..tar.gz

3.创建nginx软件安装路径

mkdir -p /opt/app/nginx

4.解压nginx源码包,并进入解压后的目录

[root@testvm software]# tar -zxf nginx-1.14..tar.gz
[root@testvm software]# ls -l
total
drwxr-xr-x. Apr : nginx-1.14.
-rw-r--r--. root root Apr : nginx-1.14..tar.gz
[root@testvm software]# cd nginx-1.14.
[root@testvm nginx-1.14.]# ls -l
total
drwxr-xr-x. Apr : auto
-rw-r--r--. Apr : CHANGES
-rw-r--r--. Apr : CHANGES.ru
drwxr-xr-x. Apr : conf
-rwxr-xr-x. Apr : configure
drwxr-xr-x. Apr : contrib
drwxr-xr-x. Apr : html
-rw-r--r--. Apr : LICENSE
drwxr-xr-x. Apr : man
-rw-r--r--. Apr : README
drwxr-xr-x. Apr : src

5.安装nginx编译,安装时需要的依赖软件包

  5.1安装开发者工具组"Development tools"

yum groupinstall "Development tools" --assumeyes

  5.2安装zlib,zlib-devel,openssl,openss-devel,pcre,pcre-devel软件包

yum install -y zlib zlib-devel openssl openssl-devel pcre pcre-devel

6.创建nginx用户,用户组

useradd nginx
id nginx

7.进入nginx源码包解压后的目录,配置nginx

./configure --prefix=/opt/app/nginx \
--user=nginx \
--group=nginx \
--sbin-path=/opt/app/nginx/sbin/nginx \
--conf-path=/opt/app/nginx/conf/nginx.conf \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--error-log-path=/opt/app/nginx/log/error.log \
--http-log-path=/opt/app/nginx/log/access.log \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-pcre \
--with-file-aio \
--with-http_realip_module \
--without-http_scgi_module \
--without-http_uwsgi_module

备注:配置过程,可以设置不同的组件.

执行过程:

[root@testvm nginx-1.14.0]# ./configure --prefix=/opt/app/nginx \
> --user=nginx \
> --group=nginx \
> --sbin-path=/opt/app/nginx/sbin/nginx \
> --conf-path=/opt/app/nginx/conf/nginx.conf \
> --pid-path=/var/run/nginx.pid \
> --lock-path=/var/run/nginx.lock \
> --error-log-path=/opt/app/nginx/log/error.log \
> --http-log-path=/opt/app/nginx/log/access.log \
> --with-http_gzip_static_module \
> --with-http_stub_status_module \
> --with-http_ssl_module \
> --with-pcre \
> --with-file-aio \
> --with-http_realip_module \
> --without-http_scgi_module \
> --without-http_uwsgi_module
checking for OS
 + Linux 2.6.32-504.el6.x86_64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... found
checking for EPOLLRDHUP ... found
checking for EPOLLEXCLUSIVE ... not found
checking for O_PATH ... not found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... found
checking for prctl(PR_SET_KEEPCAPS) ... found
checking for capabilities ... found
checking for crypt_r() ... found
checking for sys/vfs.h ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... found
checking for O_DIRECT ... found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... not found
checking for dlopen() in libdl ... found
checking for sched_yield() ... found
checking for sched_setaffinity() ... found
checking for SO_SETFIB ... not found
checking for SO_REUSEPORT ... found
checking for SO_ACCEPTFILTER ... not found
checking for SO_BINDANY ... not found
checking for IP_TRANSPARENT ... found
checking for IP_BINDANY ... not found
checking for IP_BIND_ADDRESS_NO_PORT ... not found
checking for IP_RECVDSTADDR ... not found
checking for IP_SENDSRCADDR ... not found
checking for IP_PKTINFO ... found
checking for IPV6_RECVPKTINFO ... found
checking for TCP_DEFER_ACCEPT ... found
checking for TCP_KEEPIDLE ... found
checking for TCP_FASTOPEN ... not found
checking for TCP_INFO ... found
checking for accept4() ... found
checking for kqueue AIO support ... not found
checking for Linux AIO support ... found
checking for int size ... 4 bytes
checking for long size ... 8 bytes
checking for long long size ... 8 bytes
checking for void * size ... 8 bytes
checking for uint32_t ... found
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system byte ordering ... little endian
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for AF_INET6 ... found
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for pwritev() ... found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for clock_gettime(CLOCK_MONOTONIC) ... not found
checking for clock_gettime(CLOCK_MONOTONIC) in librt ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for POSIX semaphores ... not found
checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
checking for PCRE library ... found
checking for PCRE JIT support ... not found
checking for OpenSSL library ... found
checking for zlib library ... found
creating objs/Makefile Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + using system zlib library   nginx path prefix: "/opt/app/nginx"
  nginx binary file: "/opt/app/nginx/sbin/nginx"
  nginx modules path: "/opt/app/nginx/modules"
  nginx configuration prefix: "/opt/app/nginx/conf"
  nginx configuration file: "/opt/app/nginx/conf/nginx.conf"
  nginx pid file: "/var/run/nginx.pid"
  nginx error log file: "/opt/app/nginx/log/error.log"
  nginx http access log file: "/opt/app/nginx/log/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"

备注:在配置过程中设置nginx的安装路径,启动用户,配置文件的路径,日志文件路径

8.编译,安装

make
make install

9.安装完成之后,查看nginx目录中内容

[root@testvm nginx]# pwd
/opt/app/nginx
[root@testvm nginx]# ll
total
drwxr-xr-x. root root Apr : conf
drwxr-xr-x. root root Apr : html
drwxr-xr-x. root root Apr : log
drwxr-xr-x. root root Apr : sbin

10.启动nginx,查看启动后的后台进程信息

[root@testvm nginx]# ps -ef | grep nginx
root      4259  1307  0 10:22 pts/0    00:00:00 grep nginx
[root@testvm nginx]# /opt/app/nginx/sbin/nginx -c /opt/app/nginx/conf/nginx.conf
[root@testvm nginx]# ps -ef | grep nginx
root      4261     1  0 10:22 ?        00:00:00 nginx: master process /opt/app/nginx/sbin/nginx -c /opt/app/nginx/conf/nginx.conf
nginx     4262  4261  0 10:22 ?        00:00:00 nginx: worker process                                      
root      4264  1307  0 10:22 pts/0    00:00:00 grep nginx

11.通过浏览器页面进行查看

备注:已经能够通过页面进行访问,nginx安装正确.

文档创建时间:2018年4月24日10:23:57

linux环境中,nginx安装过程的更多相关文章

  1. 【事件中心 Azure Event Hub】在Linux环境中(Ubuntu)安装Logstash的简易步骤及配置连接到Event Hub

    在文章([事件中心 Azure Event Hub]使用Logstash消费EventHub中的event时遇见的几种异常(TimeoutException, ReceiverDisconnected ...

  2. zip格式jdk在Linux环境下的安装过程

    1下载jdk [root@localhost opt]# cd soft_bak/[root@localhost soft_bak]# lsjdk1.7.0_25.zip postgresql-9.4 ...

  3. Linux(CentOS7)下Nginx安装

    记录一下 Linux(CentOS7) 下 Nginx 安装过程 一.准备工作 版本说明: Linux版本:CentOS 7 64位 Nginx版本:nginx-1.20.0 1. 下载安装文件 采用 ...

  4. linux系统中Nginx+FFmPeg+vlc实现网页视频播放配置过程

    linux系统中Nginx+FFmPeg实现网页监控视频播放配置过程 1.安装好的nginx上添加模块nginx-http-fiv-module-master 此模块是rtmp模块的升级版,有它所有的 ...

  5. 全世界最详细的图形化VMware中linux环境下oracle安装(二)【weber出品必属精品】

    <ORACLE 10.2.05版本的升级补丁安装> 首先我们解压 $ unzip p8202632_10205_LINUX.zip 解压后我们会发现多出了个文件夹,他是:Disk1,进入D ...

  6. 全世界最详细的图形化VMware中linux环境下oracle安装(一)【weber出品必属精品】

    安装流程:前期准备工作--->安装ORACLE软件--->安装升级补丁--->安装odbc创建数据库--->安装监听器--->安装EM <前期准备工作> 安装 ...

  7. Linux中Nginx安装与配置详解

    转载自:http://www.linuxidc.com/Linux/2016-08/134110.htm Linux中Nginx安装与配置详解(CentOS-6.5:nginx-1.5.0). 1 N ...

  8. linux环境中安装ftp服务

    需求说明: 今天项目中有一个新的需求,需要在linux环境中搭建一个ftp服务,在此记录下. 操作过程: 1.通过yum的方式安装ftp服务对应的软件包 [root@testvm01 ~]# yum ...

  9. linux中Nginx安装

    linux中Nginx安装 编译安装 ​ Nginx的优点太多,这里不再赘述,详情请看这篇博客深入理解nginx. ​ Nginx的安装有rpm包安装.编译安装和docker安装.本文将介绍编译安装方 ...

随机推荐

  1. SQL SEREVR IO

    Designing High Performance I/O Systems for SQL Server https://sqlbits.com/Downloads/86/Designing%20I ...

  2. Windows mobile 下读取手机SIM卡信息(转)

    Windows mobile 下读取手机SIM卡信息 c#改善 Windows mobile 下读取手机SIM卡信息

  3. angular学习笔记(九)-css类和样式3

    再来看一个选择li列表的例子: 点击li中的任意项,被点击的li高亮显示: <!DOCTYPE html> <html ng-app> <head> <tit ...

  4. jQuery.extend()中的布尔值的作用

    jQuery.extend()中,第一个参数可以添加一个布尔值,表示是否深层拷贝,默认是false.但如果设置为true,则表示深层拷贝. 下面来看看什么是深层拷贝: <script type= ...

  5. 【Ubuntu】用户切换到root

    出于安全考虑,默认时 Ubuntu 的 root 用户时没有固定密码的,它的密码是随机产生并且动态改变的,貌似是每5分钟改变一次,所以用 su(switch user) 是不可以的,因为我们不知道 r ...

  6. C++11 容器Array

    array是一个固定大小的顺序容器,不能动态改变大小,array内的元素在内存中以严格的线性顺序存储与普通数组声明存储空间大小[]的方式是一样有效的,只是加入了一些成员函数和全局函数[get (arr ...

  7. 【转】10张图带你深入理解Docker容器和镜像

    [转自]:http://dockone.io/article/783 待续

  8. Hbase1.1.x Java版之批量查删操作

    import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.*; import org.apache.had ...

  9. weblogic连接池问题总结(转载)

    转自:某局Weblogic 连接池问题(现场报告)(Connection has been administratively disabled. Try later.) 目录 1. 概述 3 1.1 ...

  10. java的static块执行时机<转>

    一.误区:简单认为JAVA静态代码块在类被加载时就会自动执行.证错如下: class MyClass1 { static {//静态块 System.out.println("static  ...