欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

Nginx【1】编译安装Nginx

时间:2023-07-23
文章目录

配置介绍编译

下载nginx

wget http://nginx.org/download/nginx-1.20.2.tar.gztar -zxvf nginx-1.20.2.tar.gz

配置介绍

$ ls -l总用量 788drwxr-xr-x 6 1001 1001 326 2月 7 11:10 auto-rw-r--r-- 1 1001 1001 312251 11月 16 22:44 CHANGES #版本特性-rw-r--r-- 1 1001 1001 476577 11月 16 22:44 CHANGES.ru #俄罗斯版本特性说明drwxr-xr-x 2 1001 1001 168 2月 7 11:10 conf #配置文件-rwxr-xr-x 1 1001 1001 2590 11月 16 22:44 configure #编译前必备动作drwxr-xr-x 4 1001 1001 72 2月 7 11:10 contrib #提供vim色彩drwxr-xr-x 2 1001 1001 40 2月 7 11:10 html #默认html文件-rw-r--r-- 1 1001 1001 1397 11月 16 22:44 LICENSEdrwxr-xr-x 2 1001 1001 21 2月 7 11:10 man #帮助文件-rw-r--r-- 1 1001 1001 49 11月 16 22:44 READMEdrwxr-xr-x 9 1001 1001 91 2月 7 11:10 src #源代码#auto目录有四个子目录:cc编译目录、lib依赖库、os操作系统的判断模块的使用$ ls -l auto/总用量 188drwxr-xr-x 2 1001 1001 133 2月 7 11:10 cc-rw-r--r-- 1 1001 1001 141 11月 16 22:44 define-rw-r--r-- 1 1001 1001 889 11月 16 22:44 endianness-rw-r--r-- 1 1001 1001 2812 11月 16 22:44 feature-rw-r--r-- 1 1001 1001 136 11月 16 22:44 have-rw-r--r-- 1 1001 1001 137 11月 16 22:44 have_headers-rw-r--r-- 1 1001 1001 411 11月 16 22:44 headers-rw-r--r-- 1 1001 1001 1020 11月 16 22:44 include-rw-r--r-- 1 1001 1001 768 11月 16 22:44 init-rw-r--r-- 1 1001 1001 4875 11月 16 22:44 installdrwxr-xr-x 11 1001 1001 163 2月 7 11:10 lib-rw-r--r-- 1 1001 1001 18324 11月 16 22:44 make-rw-r--r-- 1 1001 1001 3934 11月 16 22:44 module-rw-r--r-- 1 1001 1001 38640 11月 16 22:44 modules-rw-r--r-- 1 1001 1001 136 11月 16 22:44 nohave-rw-r--r-- 1 1001 1001 25469 11月 16 22:44 optionsdrwxr-xr-x 2 1001 1001 88 2月 7 11:10 os-rw-r--r-- 1 1001 1001 8752 11月 16 22:44 sources-rw-r--r-- 1 1001 1001 120 11月 16 22:44 stubs-rw-r--r-- 1 1001 1001 2014 11月 16 22:44 summary-rw-r--r-- 1 1001 1001 394 11月 16 22:44 threadsdrwxr-xr-x 2 1001 1001 65 2月 7 11:10 types-rw-r--r-- 1 1001 1001 26166 11月 16 22:44 unix#提供色彩方法$ mkdir ~/.vim $ cp -r contrib/vim/* ~/.vim/#两个html标准文件$ tree html/html/├── 50x.html└── index.html

编译

查看帮助

$ ./configure --help$ ./configure --prefix=/opt/nginxchecking for OS + Linux 3.10.0-1160.49.1.el7.x86_64 x86_64checking for C compiler ..、found + using GNU C compiler + gcc version: 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) checking for gcc -pipe switch ..、foundchecking for -Wl,-E switch ..、foundchecking for gcc builtin atomic operations ..、foundchecking for C99 variadic macros ..、foundchecking for gcc variadic macros ..、foundchecking for gcc builtin 64 bit byteswap ..、foundchecking for unistd.h ..、foundchecking for inttypes.h ..、foundchecking for limits.h ..、foundchecking for sys/filio.h ..、not foundchecking for sys/param.h ..、foundchecking for sys/mount.h ..、foundchecking for sys/statvfs.h ..、foundchecking for crypt.h ..、foundchecking for Linux specific featureschecking for epoll ..、foundchecking for EPOLLRDHUP ..、foundchecking for EPOLLEXCLUSIVE ..、not foundchecking for eventfd() ..、foundchecking for O_PATH ..、foundchecking for sendfile() ..、foundchecking for sendfile64() ..、foundchecking for sys/prctl.h ..、foundchecking for prctl(PR_SET_DUMPABLE) ..、foundchecking for prctl(PR_SET_KEEPCAPS) ..、foundchecking for capabilities ..、foundchecking for crypt_r() ..、foundchecking for sys/vfs.h ..、foundchecking for nobody group ..、foundchecking for poll() ..、foundchecking for /dev/poll ..、not foundchecking for kqueue ..、not foundchecking for crypt() ..、not foundchecking for crypt() in libcrypt ..、foundchecking for F_READAHEAD ..、not foundchecking for posix_fadvise() ..、foundchecking for O_DIRECT ..、foundchecking for F_NOCACHE ..、not foundchecking for directio() ..、not foundchecking for statfs() ..、foundchecking for statvfs() ..、foundchecking for dlopen() ..、not foundchecking for dlopen() in libdl ..、foundchecking for sched_yield() ..、foundchecking for sched_setaffinity() ..、foundchecking for SO_SETFIB ..、not foundchecking for SO_REUSEPORT ..、foundchecking for SO_ACCEPTFILTER ..、not foundchecking for SO_BINDANY ..、not foundchecking for IP_TRANSPARENT ..、foundchecking for IP_BINDANY ..、not foundchecking for IP_BIND_ADDRESS_NO_PORT ..、foundchecking for IP_RECVDSTADDR ..、not foundchecking for IP_SENDSRCADDR ..、not foundchecking for IP_PKTINFO ..、foundchecking for IPV6_RECVPKTINFO ..、foundchecking for TCP_DEFER_ACCEPT ..、foundchecking for TCP_KEEPIDLE ..、foundchecking for TCP_FASTOPEN ..、foundchecking for TCP_INFO ..、foundchecking for accept4() ..、foundchecking for int size ..、4 byteschecking for long size ..、8 byteschecking for long long size ..、8 byteschecking for void * size ..、8 byteschecking for uint32_t ..、foundchecking for uint64_t ..、foundchecking for sig_atomic_t ..、foundchecking for sig_atomic_t size ..、4 byteschecking for socklen_t ..、foundchecking for in_addr_t ..、foundchecking for in_port_t ..、foundchecking for rlim_t ..、foundchecking for uintptr_t ..、uintptr_t foundchecking for system byte ordering ..、little endianchecking for size_t size ..、8 byteschecking for off_t size ..、8 byteschecking for time_t size ..、8 byteschecking for AF_INET6 ..、foundchecking for setproctitle() ..、not foundchecking for pread() ..、foundchecking for pwrite() ..、foundchecking for pwritev() ..、foundchecking for strerrordesc_np() ..、not foundchecking for sys_nerr ..、foundchecking for localtime_r() ..、foundchecking for clock_gettime(CLOCK_MONOTONIC) ..、foundchecking for posix_memalign() ..、foundchecking for memalign() ..、foundchecking for mmap(MAP_ANON|MAP_SHARED) ..、foundchecking for mmap("/dev/zero", MAP_SHARED) ..、foundchecking for System V shared memory ..、foundchecking for POSIX semaphores ..、not foundchecking for POSIX semaphores in libpthread ..、foundchecking for struct msghdr.msg_control ..、foundchecking for ioctl(FIONBIO) ..、foundchecking for ioctl(FIONREAD) ..、foundchecking for struct tm.tm_gmtoff ..、foundchecking for struct dirent.d_namlen ..、not foundchecking for struct dirent.d_type ..、foundchecking for sysconf(_SC_NPROCESSORS_ONLN) ..、foundchecking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ..、foundchecking for openat(), fstatat() ..、foundchecking for getaddrinfo() ..、foundchecking for PCRE library ..、foundchecking for PCRE JIT support ..、foundchecking for zlib library ..、foundcreating objs/MakefileConfiguration summary + using system PCRE library + OpenSSL library is not used + using system zlib library nginx path prefix: "/opt/nginx" nginx binary file: "/opt/nginx/sbin/nginx" nginx modules path: "/opt/nginx/modules" nginx configuration prefix: "/opt/nginx/conf" nginx configuration file: "/opt/nginx/conf/nginx.conf" nginx pid file: "/opt/nginx/logs/nginx.pid" nginx error log file: "/opt/nginx/logs/error.log" nginx http access log file: "/opt/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"

编译后会生成中间件文件,在objs目录下,动态文件也会放置到objs,以及编译后文件放到objs/src目录下

$ ls -l objs/总用量 80-rw-r--r-- 1 root root 17882 2月 7 12:04 autoconf.err-rw-r--r-- 1 root root 39886 2月 7 12:04 Makefile-rw-r--r-- 1 root root 6950 2月 7 12:04 ngx_auto_config.h-rw-r--r-- 1 root root 657 2月 7 12:03 ngx_auto_headers.h-rw-r--r-- 1 root root 5856 2月 7 12:04 ngx_modules.cdrwxr-xr-x 9 root root 91 2月 7 12:04 src

ngx_modules.c决定了哪些模块被编译到nginx。

$ make && make install$ ls -l /opt/nginx/总用量 0drwxr-xr-x 2 root root 333 2月 7 12:11 confdrwxr-xr-x 2 root root 40 2月 7 12:11 htmldrwxr-xr-x 2 root root 6 2月 7 12:11 logsdrwxr-xr-x 2 root root 19 2月 7 12:11 sbin

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。