第一步:下载nginx
[root@localhost liulangyu]# cd software/
[root@localhost software]# wget http://nginx.org/download/nginx-1.9.3.tar.gz
--2015-07-18 02:25:40-- http://nginx.org/download/nginx-1.9.3.tar.gz
正在解析主机 nginx.org (nginx.org)... 206.251.255.63, 2606:7100:1:69::3f
正在连接 nginx.org (nginx.org)|206.251.255.63|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:864430 (844K) [application/octet-stream]
正在保存至: “nginx-1.9.3.tar.gz”
100%[======================================>] 864,430 92.1KB/s 用时 13s
2015-07-18 02:25:59 (64.8 KB/s) - 已保存 “nginx-1.9.3.tar.gz” [864430/864430])
第二步:解压nginx
[root@localhost software]# tar zxvf nginx-1.9.3.tar.gz
[root@localhost software]# ls
nginx-1.9.3 nginx-1.9.3.tar.gz
第三步:添加需要的依赖
[root@localhost software]# yum -y install pcre-devel openssl openssl-devel
第四步:./configure执行配置文件
[root@localhost nginx-1.9.3]# ./configure --prefix=/usr/local/nginx
checking for OS
+ Linux 3.10.0-123.el7.x86_64 x86_64
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC)
checking for gcc -pipe switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... 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 O_PATH ... found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... found
checking for sched_setaffinity() ... found
checking for crypt_r() ... found
checking for sys/vfs.h ... found
checking for nobody group ... 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 SO_SETFIB ... not found
checking for SO_REUSEPORT ... found
checking for SO_ACCEPTFILTER ... not 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 eventfd() ... 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 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 setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for sys_nerr ... found
checking for localtime_r() ... 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 openat(), fstatat() ... found
checking for getaddrinfo() ... found
checking for PCRE library ... found
checking for PCRE JIT support ... found
checking for md5 in system md library ... not found
checking for md5 in system md5 library ... not found
checking for md5 in system OpenSSL crypto library ... found
checking for sha1 in system md library ... not found
checking for sha1 in system OpenSSL crypto library ... found
checking for zlib library ... found
creating objs/Makefile
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/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 http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
第五步:make 代码变成可执行文件
[root@localhost nginx-1.9.3]#make
第六步:make install进行软件安装
[root@localhost nginx-1.9.3]# make install
make -f objs/Makefile install
make[1]: 进入目录“/home/liulangyu/software/nginx-1.9.3”
test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx'
test -d '/usr/local/nginx/sbin' || mkdir -p '/usr/local/nginx/sbin'
test ! -f '/usr/local/nginx/sbin/nginx' || mv '/usr/local/nginx/sbin/nginx' '/usr/local/nginx/sbin/nginx.old'
cp objs/nginx '/usr/local/nginx/sbin/nginx'
test -d '/usr/local/nginx/conf' || mkdir -p '/usr/local/nginx/conf'
cp conf/koi-win '/usr/local/nginx/conf'
cp conf/koi-utf '/usr/local/nginx/conf'
cp conf/win-utf '/usr/local/nginx/conf'
test -f '/usr/local/nginx/conf/mime.types' || cp conf/mime.types '/usr/local/nginx/conf'
cp conf/mime.types '/usr/local/nginx/conf/mime.types.default'
test -f '/usr/local/nginx/conf/fastcgi_params' || cp conf/fastcgi_params '/usr/local/nginx/conf'
cp conf/fastcgi_params '/usr/local/nginx/conf/fastcgi_params.default'
test -f '/usr/local/nginx/conf/fastcgi.conf' || cp conf/fastcgi.conf '/usr/local/nginx/conf'
cp conf/fastcgi.conf '/usr/local/nginx/conf/fastcgi.conf.default'
test -f '/usr/local/nginx/conf/uwsgi_params' || cp conf/uwsgi_params '/usr/local/nginx/conf'
cp conf/uwsgi_params '/usr/local/nginx/conf/uwsgi_params.default'
test -f '/usr/local/nginx/conf/scgi_params' || cp conf/scgi_params '/usr/local/nginx/conf'
cp conf/scgi_params '/usr/local/nginx/conf/scgi_params.default'
test -f '/usr/local/nginx/conf/nginx.conf' || cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf'
cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default'
test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/html' || cp -R html '/usr/local/nginx'
test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs'
make[1]: 离开目录“/home/liulangyu/software/nginx-1.9.3”
第七步 验证nginx的配置文件是否正确
[root@localhost nginx-1.9.3]# cd /usr/local/nginx
[root@localhost nginx]# ls
conf html logs sbin
[root@localhost nginx]# cd sbin/
[root@localhost sbin]# ./nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
第八步:启动nginx
[root@localhost sbin]# ./nginx
第九步:netstat 查看nginx端口是否启动
[root@localhost sbin]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2363/master
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1795/rpcbind
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 54188/nginx: master
tcp 0 0 0.0.0.0:42321 0.0.0.0:* LISTEN 1861/rpc.statd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 37040/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3203/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 2363/master
tcp6 0 0 :::111 :::* LISTEN 1795/rpcbind
tcp6 0 0 :::22 :::* LISTEN 37040/sshd
tcp6 0 0 ::1:631 :::* LISTEN 3203/cupsd
tcp6 0 0 :::43447 :::* LISTEN 1861/rpc.statd
下面这句表示启动成功
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 54188/nginx: master
相关推荐
### CentOS 7 安装 Nginx 1.16.1 #### 一、概述 本篇文章将详细介绍如何在 CentOS 7 上安装 Nginx 1.16.1 版本。Nginx 是一款轻量级的 Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,由俄罗斯的...
【CentOS7安装Nginx】 在CentOS7上安装Nginx有两种主要方式:源码安装和Yum安装。 **源码安装** 1. **安装依赖**:首先,确保系统中已经安装了必要的编译工具和库,如GCC、pcre、zlib和openssl等。可以通过以下...
"CentOS 7 安装 Nginx 服务器" 本文将指导您在 CentOS 7 操作系统上安装 Nginx 服务器,需要安装的依赖项包括 GCC、PCRE、Zlib、OpenSSL 等,并下载 Nginx 安装包,解压、编译和安装 Nginx 服务器。 一、安装 GCC ...
### CentOS 7 下安装 Nginx (有网络与无网络环境) #### 一、概述 Nginx 是一款广泛使用的高性能 HTTP 和反向代理 Web 服务器,同时也提供了 IMAP/POP3/SMTP 服务。其特点是占有内存少,并发能力强,事实上很多网站...
### CentOS7安装Nginx1.11详细步骤与配置指南 #### 一、环境准备与依赖安装 在正式开始安装Nginx之前,确保你的系统是CentOS 7,并且已经更新到了最新版本。接下来,我们需要安装一些必要的依赖包。 1. **安装...
在本篇关于在CentOS 7上安装nginx的文档中,详细介绍了从下载、配置到启动Nginx的完整过程,同时涵盖了对防火墙的配置和对Nginx进行基本管理操作的步骤。以下将对这些知识点进行详细阐述: ### 1. 下载Nginx 在...
CentOS7+,压缩保证包含 gcc\gcc-c++所有安装rpm包;openssl包;zlib包;pcre的包以及nginx安装包,支持Linux下离线安装nginx 如下: nginx-1.15.12.tar.gz openssl-1.0.2r.tar.gz pcre-8.42.tar.gz zlib-1.2.11.tar...
在这个场景中,我们有一个名为"nginx-centos7"的压缩包,这个包里包含了在CentOS 7上安装Nginx所需的所有RPM(Red Hat Package Manager)软件包。 离线安装的步骤如下: 1. **下载所需软件包**:通常,这一步会在...
这篇教程将详细讲解如何在CentOS 7上安装Nginx。 1. **安装前准备** 在开始安装前,确保你的系统是最新的。打开终端,运行以下命令更新系统: ``` sudo yum update -y ``` 2. **安装EPEL仓库** Nginx不在...
在本文中,我们将深入探讨如何在CentOS 7操作系统上安装Nginx web服务器和PHP 7集成环境,以便能够支持动态网页内容。Nginx以其高性能和稳定性著称,而PHP 7则是广泛使用的服务器端脚本语言,用于创建交互式、数据...
在 Linux 系统中,尤其是 CentOS 7,Nginx 被广泛用于网站托管和负载均衡。本资源提供的是 Nginx 的 1.24.0 版本,它是一个预编译好的二进制包,无需进行编译安装,简化了部署流程。 **安装与部署** 1. 首先,将...
这样,你就成功地解决了CentOS 7安装Nginx后出现的"Welcome to nginx on Fedora!"的问题,并确保系统使用的是适合CentOS的Nginx配置。记住,正确配置和维护服务器上的软件是保持系统安全和高效运行的关键。对于任何...
本文将详细介绍如何在CentOS 7.6上进行离线安装Nginx,这对于网络环境不稳定或者没有互联网连接的服务器尤为实用。 首先,确保你的系统是最新的。打开终端并运行以下命令来更新系统包: ```bash sudo yum update -...
cd /tmp/centOS7安装nginx安装包以及所有依赖包 ``` 3. 给Nginx安装脚本或可执行文件赋予执行权限: ``` chmod +x nginx安装脚本.sh ``` 这里的"nginx安装脚本.sh"应替换为实际的文件名。 4. 运行安装脚本来安装...
在本文中,我们将深入探讨如何在CentOS 7系统上离线安装Nginx流媒体服务器,特别是针对RTMP协议的实现。这个资源包包含了所有必要的软件包,使得在没有互联网连接的情况下也能顺利完成安装。 首先,`CentOS 7` 是一...
在完全无互联网连接的情况下,离线安装nginx。 nginx版本号:nginx-1.20.1-2.el7.x86_64 食用方法: 1.解压 2.进入解压目录 3.rpm安装全部 4.安装完成
在Linux环境中,CentOS系统是常用的服务器操作系统,而Nginx是一款高性能的HTTP和反向代理服务器,常用于网站服务。在非root权限下安装Nginx,即不使用管理员权限进行安装,需要一些额外的步骤和技巧。下面将详细...
**CentOS 6.3 安装 Nginx 操作指南** 在 CentOS 6.3 上安装 Nginx 是一项常见的任务,Nginx 是一个高性能的 Web 和反向代理服务器,以其轻量级、高效的特性深受开发者和系统管理员的喜爱。本指南将详细解释如何在 ...
本压缩包"centOS7离线安装nginx依赖包.zip"显然是为了帮助用户在没有网络连接的环境中在CentOS 7上安装Nginx。离线安装意味着我们需要预先准备所有必要的依赖包,以便在目标机器上进行安装。 首先,了解Nginx的基本...