欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

CentOS 7下編譯安裝Nginx 1.11.10教程

 更新時(shí)間:2017年03月15日 09:38:21   作者:不爭(zhēng)  
這篇文章主要介紹了在CentOS 7下編譯安裝Nginx 1.11.10的方法,文中給出了詳細(xì)的安裝步驟,相信對(duì)大家具有一定的參考價(jià)值,需要的朋友們下面來一起看看吧。

前言

之前分享過一篇 CentOS下編譯安裝nginx及配置縮略圖插件的方法教程,當(dāng)時(shí)的環(huán)境是 CentOS 6.x 和 Nginx 1.9.x 。 本次安裝的環(huán)境為 CentOS 7.2 和 Nginx 1.11.10, 有些配置以前自啟動(dòng)的方式發(fā)生了變化, 這里再記錄一下。

安裝編譯安裝依賴的類庫和包

yum install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre-devel

下載和解壓 Nginx 1.11.10

wget http://nginx.org/download/nginx-1.11.10.tar.gz
tar -xzvf nginx-1.11.10.tar.gz
cd nginx-1.11.10

配置 Nginx 安裝選項(xiàng)

這里編譯了插件 http_image_filter_module, 來實(shí)現(xiàn)圖片的處理,采用默認(rèn)的安裝路徑進(jìn)行安裝。

./configure\
 --with-http_ssl_module\
 --with-http_v2_module\
 --with-http_realip_module\
 --with-http_addition_module\
 --with-http_xslt_module\
 --with-http_image_filter_module\
 --with-http_sub_module\
 --with-http_auth_request_module\
 --with-http_stub_status_module\
 --with-http_gzip_static_module

運(yùn)行結(jié)果如下

[root@xx nginx-1.11.10]# ./configure\
> --with-http_ssl_module\
> --with-http_v2_module\
> --with-http_realip_module\
> --with-http_addition_module\
> --with-http_xslt_module\
> --with-http_image_filter_module\
> --with-http_sub_module\
> --with-http_auth_request_module\
> --with-http_stub_status_module\
> --with-http_gzip_static_module
checking for OS
 + Linux 3.10.0-327.22.2.el7.x86_64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.8.5 20150623 (Red Hat 4.8.5-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 ... 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 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 SO_BINDANY ... not found
checking for IP_BIND_ADDRESS_NO_PORT ... not found
checking for IP_TRANSPARENT ... found
checking for IP_BINDANY ... not found
checking for IP_RECVDSTADDR ... 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 ... 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 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 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 OpenSSL library ... found
checking for zlib library ... found
checking for libxslt ... found
checking for libexslt ... found
checking for GD library ... found
checking for GD WebP support ... not found
creating objs/Makefile
Configuration summary
 + using system PCRE library
 + using system OpenSSL library
 + using system zlib library
 nginx path prefix: "/usr/local/nginx"
 nginx binary file: "/usr/local/nginx/sbin/nginx"
 nginx modules path: "/usr/local/nginx/modules"
 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"

最后的幾行是配置的結(jié)果, 注意這里的 pid file 那一行,后面配置服務(wù)的時(shí)候,需要用的到。

安裝 Nginx

使用如下命令來安裝 nginx 。

make && make install

配置 systemd Nginx 服務(wù)和設(shè)置 Nginx 自啟動(dòng)

centos 7 中采用 systemd 來管理系統(tǒng),我們來為 nginx 創(chuàng)建服務(wù)文件,來實(shí)現(xiàn)通過 systemd 來管理 nginx 。

創(chuàng)建 systemd 服務(wù)文件: /lib/systemd/system/nginx.service,內(nèi)容如下:

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target

這里的 PIDFile 的配置要和前面的 配置保持一致。

設(shè)置自啟動(dòng)

systemctl enable nginx

通過 systemd 管理 nginx

systemctl start nginx
systemctl stop nginx
systemctl restart nginx
systemctl reload nginx

總結(jié)

好了,打完收工。以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對(duì)腳本之家的支持。

相關(guān)文章

  • Nginx中的用戶認(rèn)證配置及阻止用戶使用代理訪問的方法

    Nginx中的用戶認(rèn)證配置及阻止用戶使用代理訪問的方法

    這篇文章主要介紹了Nginx中的用戶認(rèn)證配置及阻止用戶使用代理訪問的方法,用戶認(rèn)證部分用到了自帶的ngx_http_auth_basic_module模塊,需要的朋友可以參考下
    2016-01-01
  • nginx cache不緩存問題的原因與解決方案

    nginx cache不緩存問題的原因與解決方案

    最近在工作中遇到了一個(gè)問題,發(fā)現(xiàn)nginx cache居然不緩存,后來通過查找網(wǎng)上的資料找到了原因和解決方案,下面整理好分享給大家,同樣遇到這個(gè)問題的朋友們可以參考借鑒,下面和小編一起來學(xué)習(xí)學(xué)習(xí)吧。
    2016-10-10
  • Nginx反向代理多域名的HTTP和HTTPS服務(wù)的實(shí)現(xiàn)

    Nginx反向代理多域名的HTTP和HTTPS服務(wù)的實(shí)現(xiàn)

    這篇文章主要介紹了Nginx反向代理多域名的HTTP和HTTPS服務(wù)的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-06-06
  • nginx簡(jiǎn)單配置多個(gè)server的方法

    nginx簡(jiǎn)單配置多個(gè)server的方法

    這篇文章主要介紹了nginx簡(jiǎn)單配置多個(gè)server的方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-11-11
  • nginx靜態(tài)資源的服務(wù)器配置方法

    nginx靜態(tài)資源的服務(wù)器配置方法

    Nginx本身也是一個(gè)靜態(tài)資源的服務(wù)器,當(dāng)只有靜態(tài)資源的時(shí)候,就可以使用Nginx來做服務(wù)器,同時(shí)現(xiàn)在也很流行動(dòng)靜分離,就可以通過Nginx來實(shí)現(xiàn),這篇文章主要介紹了nginx靜態(tài)資源的服務(wù)器配置方法,需要的朋友可以參考下
    2022-07-07
  • 很詳細(xì)的Nginx配置說明

    很詳細(xì)的Nginx配置說明

    這篇文章主要為大家分享了一篇很詳細(xì)的Nginx配置說明,主要內(nèi)容包括Nginx常用功能、Nginx配置文件結(jié)構(gòu),想要了解Nginx配置的朋友不要錯(cuò)過,參考一下
    2016-02-02
  • Nginx的location路徑與proxy_pass匹配規(guī)則說明

    Nginx的location路徑與proxy_pass匹配規(guī)則說明

    這篇文章主要介紹了Nginx的location路徑與proxy_pass匹配規(guī)則說明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-06-06
  • Nginx訪問日志切割的3種實(shí)現(xiàn)方法

    Nginx訪問日志切割的3種實(shí)現(xiàn)方法

    這篇文章主要給大家介紹了關(guān)于Nginx訪問日志切割的3種實(shí)現(xiàn)方法,隨著訪問量的增長(zhǎng),日志文件會(huì)越來越大,時(shí)間長(zhǎng)既會(huì)影響訪問的速度,也會(huì)占用一部分磁盤空間,這時(shí)候就需要日志切割了,需要的朋友可以參考下
    2023-08-08
  • 詳解Nginx反向代理跨域基本配置與常見誤區(qū)

    詳解Nginx反向代理跨域基本配置與常見誤區(qū)

    這篇文章主要介紹了詳解Nginx反向代理跨域基本配置與常見誤區(qū),小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-08-08
  • Mac上搭建nginx+rtmp直播服務(wù)器的步驟詳解

    Mac上搭建nginx+rtmp直播服務(wù)器的步驟詳解

    最近的直播很火,所以這篇文章跟大家分享了在Mac上搭建nginx+rtmp直播服務(wù)器的步驟,文章通過一步步圖文介紹的很詳細(xì),有需要的朋友們可以參考借鑒。
    2016-09-09

最新評(píng)論