第一步:下载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
相关推荐
centos7安装nginx1.16.1安装文档,有需要的朋友们下载。 centos7安装nginx1.16.1安装文档,有需要的朋友们下载。
CentOS 7安装nginx 全过程.pdf
CentOS7安装nginx&&php7整合包
CentOS7安装Nginx1.11
centos7下在有网络和没网络的情况安装nginx;
CentOS7 Nginx安装
二、yum安装Nginx1.添加nginx的yum源Centos7自带的yum repo仓库没有nginx安装包,所以要添加nginx的yum repo源文件,
centos7离线安装nginx所需的全部软件,解压后将所有rpm包依次安装即可
centos7.6离线安装nginx
linux系统安装nginx
在完全无互联网连接的情况下,离线安装nginx。 nginx版本号:nginx-1.20.1-2.el7.x86_64 食用方法: 1.解压 2.进入解压目录 3.rpm安装全部 4.安装完成
主要介绍了Centos7安装nginx后提示“Welcome to nginx on Fedora!”,conf.d目录下无default.conf文件 ,本文给出了问题原因解析及解决方法,需要的朋友可以参考下
主要介绍了CentOS7安装Nginx并配置自动启动的方法步骤,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
Ps:如果按照包里的配置文件路径访问,需授权后才能访问,类似Windows的其他用户文件夹。 授权命令:chmod 777 *
Linux系统下安装nginx-1.14.1所需的所有包 以及rpm依赖包,安装文档 https://blog.csdn.net/weixin_41851100/article/details/89565198
centOS8安装nginx及nginx配置
这里记录一下自己在centos7操作系统下安装nginx的过程,以便之后学习时查阅。笔者这里的Linux服务器使用的是腾讯云服务器,本人是一名Java程序员也是Linux的初学者有什么不对的地方请多指教,以后还会有更多的关于...
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...
目录CentOS7安装nginx1.16.1一、去官网下载对应的nginx包,推荐使用稳定版本二、上传nginx到linux系统三、安装依赖环境3.1、安装gcc环境3.2、安装PCRE库,用于解析正则表达式3.3、zlib压缩包和解压包依赖3.4、SSL...