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

Linux 6下安裝編譯安裝Nginx的步驟

 更新時間:2017年10月26日 09:06:36   作者:Leshami  
這篇文章主要介紹了Linux 6下安裝編譯安裝Nginx的步驟的相關(guān)資料,希望通過本文能幫助到大家,需要的朋友可以參考下

Linux 6下安裝編譯安裝Nginx的步驟

前言:

Nginx是一個高性能的HTTP和反向代理服務器,也是一個IMAP/POP3/SMTP服務器。在高連接并發(fā)的情況下,Nginx是Apache服務器不錯的替代品:Nginx在美國是做虛擬主機生意的老板們經(jīng)常選擇的軟件平臺之一。能夠支持高達50,000個并發(fā)連接數(shù)的響應,而且內(nèi)存開銷極小。這也是Nginx廣受歡迎的重要原因。本文演示了基于Linux 6下編譯安裝Nginx,供大家參考。

一、安裝環(huán)境

# cat /etc/issue
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Kernel \r on an \m
# nginx -v
nginx version: nginx/1.8.0

二、配置安裝環(huán)境

###為簡化安裝及配置,此處關(guān)閉了防火墻,生產(chǎn)環(huán)境建議開啟
# service iptables stop
# chkconfig iptables off

# vi /etc/selinux/config 
SELINUX=disabled

###創(chuàng)建用戶及組
#groupadd -r nginx
#useradd -s /sbin/nologin -g nginx -r nginx

###安裝環(huán)境依賴包 http://nginx.org/en/linux_packages.html
# yum install pcre-devel zlib-devel openssl openssl-devel gcc gcc-c++

三、編譯及安裝Nginx

# cd /tmp/
# tar -xvf nginx-1.8.0.tar.gz
# cd /nginx-1.8.0
# ./configure           \
--prefix=/etc/nginx                     \
--sbin-path=/usr/sbin/nginx                 \
--conf-path=/etc/nginx/nginx.conf              \
--error-log-path=/var/log/nginx/error.log          \
--http-log-path=/var/log/nginx/access.log          \
--pid-path=/var/run/nginx.pid                \
--lock-path=/var/run/nginx.lock               \
--http-client-body-temp-path=/var/cache/nginx/client_temp  \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp      \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp    \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp      \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp       \
--user=nginx                         \
--group=nginx                        \
--with-http_ssl_module                    \
--with-http_realip_module                  \
--with-http_addition_module                 \
--with-http_sub_module                    \
--with-http_dav_module                    \
--with-http_flv_module                    \
--with-http_mp4_module                    \
--with-http_gunzip_module                  \
--with-http_gzip_static_module                \
--with-http_random_index_module               \
--with-http_secure_link_module                \
--with-http_stub_status_module                \
--with-http_auth_request_module               \
--with-mail                         \
--with-mail_ssl_module                    \
--with-file-aio                       \
--with-http_spdy_module                   \
--with-ipv6                         

Configuration summary
 + using system PCRE library
 + using system OpenSSL library
 + md5: using OpenSSL library
 + sha1: using OpenSSL library
 + using system zlib library

 nginx path prefix: "/etc/nginx"
 nginx binary file: "/usr/sbin/nginx"
 nginx configuration prefix: "/etc/nginx"
 nginx configuration file: "/etc/nginx/nginx.conf"
 nginx pid file: "/var/run/nginx.pid"
 nginx error log file: "/var/log/nginx/error.log"
 nginx http access log file: "/var/log/nginx/access.log"
 nginx http client request body temporary files: "/var/cache/nginx/client_temp"
 nginx http proxy temporary files: "/var/cache/nginx/proxy_temp"
 nginx http fastcgi temporary files: "/var/cache/nginx/fastcgi_temp"
 nginx http uwsgi temporary files: "/var/cache/nginx/uwsgi_temp"
 nginx http scgi temporary files: "/var/cache/nginx/scgi_temp"

###如果apache httpd服務啟動,建議先停止或更改端口號
# service httpd stop
# mkdir -p /var/cache/nginx/{client_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp}
# make && make install

###啟動nginx
# /usr/sbin/nginx -c /etc/nginx/nginx.conf

# ps -ef|grep nginx|grep -v grep
root   33412   1 0 10:18 ?    00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx   33413 33412 0 10:18 ?    00:00:00 nginx: worker process

[root@orasrv1 cache]# netstat -nltp|grep 80
tcp    0   0 0.0.0.0:80         0.0.0.0:*          LISTEN   33412/nginx     
[root@orasrv1 cache]# 

四、配置nginx為系統(tǒng)服務

vi /etc/init.d/nginx 

#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
#        proxy and IMAP/POP3 proxy server
# Author : Leshami
# Blog  : http://blog.csdn.net/leshami      
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /etc/nginx/nginx.conf

#path for nginx binary
nginxd=/usr/sbin/nginx

#path for nginx configuration
nginx_config=/etc/nginx/nginx.conf

#path for nginx pid
nginx_pid=/var/run/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
  echo "nginx already running...."
  exit 1
fi
  echo -n $"Starting $prog: "
  daemon $nginxd -c ${nginx_config}
  RETVAL=$?
  echo
  [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
  return $RETVAL
}
# Stop nginx daemons functions.
stop() {
    echo -n $"Stopping $prog: "
    killproc $nginxd
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
}
# reload nginx service functions.
reload() {
  echo -n $"Reloading $prog: "
  #kill -HUP `cat ${nginx_pid}`
  killproc $nginxd -HUP
  RETVAL=$?
  echo
}
# See how we were called.
case "$1" in
start)
    start
    ;;
stop)
    stop
    ;;
reload)
    reload
    ;;
restart)
    stop
    start
    ;;
status)
    status $prog
    RETVAL=$?
    ;;
*)
    echo $"Usage: $prog {start|stop|restart|reload|status|help}"
    exit 1
esac
exit $RETVAL

# chmod u+x /etc/init.d/nginx 

# service nginx start
Starting nginx:                      [ OK ]

# ps -ef|grep nginx |grep -v grep
root   33534   1 0 10:33 ?    00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx   33535 33534 0 10:33 ?    00:00:00 nginx: worker process  

# service nginx stop
Stopping nginx:                      [ OK ]

# chkconfig --add nginx
# chkconfig nginx on

五、安裝過程中的常見故障

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
### 以上2個錯誤,請安裝相應的依賴包,見本文第二部分:配置安裝環(huán)境

# /usr/sbin/nginx 
nginx: [emerg] getpwnam("nginx") failed
### 需要創(chuàng)建nginx用戶組及用戶

# /usr/sbin/nginx
nginx: [emerg] mkdir() "/var/cache/nginx/client_temp" failed (2: No such file or directory)
### 需要創(chuàng)建對應的目錄

如有疑問請留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關(guān)文章

  • Linux 3.X/4.x/5.x 忘記寶塔面板密碼的解決方法

    Linux 3.X/4.x/5.x 忘記寶塔面板密碼的解決方法

    在本篇文章里我們給大家整理的是關(guān)于忘記Linux 3.X/4.x/5.x 寶塔面板密碼的解決方案,有需要的朋友們可以學習下。
    2019-10-10
  • Linux下wget命令詳細介紹

    Linux下wget命令詳細介紹

    本文詳細講解了Linux下wget命令的使用方法,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2021-12-12
  • Ubuntu 18.04 LTS中配置IP地址的完整步驟

    Ubuntu 18.04 LTS中配置IP地址的完整步驟

    這篇文章主要給大家介紹了關(guān)于如何在Ubuntu 18.04 LTS中配置IP地址的完整步驟,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2018-12-12
  • 詳解centos7上elastic search安裝及填坑記

    詳解centos7上elastic search安裝及填坑記

    本篇文章主要介紹了centos7上elastic search安裝及填坑記,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-01-01
  • Centos 6.5 服務器優(yōu)化配置備忘(一些基礎(chǔ)優(yōu)化和安全設(shè)置)

    Centos 6.5 服務器優(yōu)化配置備忘(一些基礎(chǔ)優(yōu)化和安全設(shè)置)

    這篇文章主要介紹了Centos 6.5 服務器優(yōu)化(一些基礎(chǔ)優(yōu)化和安全設(shè)置),需要的朋友可以參考下
    2016-10-10
  • Ubuntu下安裝并配置VS Code編譯C++的方法

    Ubuntu下安裝并配置VS Code編譯C++的方法

    這篇文章主要介紹了Ubuntu下安裝并配置VS Code編譯C++的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-02-02
  • Linux read命令的使用

    Linux read命令的使用

    這篇文章主要介紹了Linux read命令的使用,幫助大家更好的理解和學習Linux,感興趣的朋友可以了解下
    2020-08-08
  • 使用ElasticSearch集群搭建步驟

    使用ElasticSearch集群搭建步驟

    本文詳細闡述了Elasticsearch搜索引擎的安裝與配置過程,包括使用RPM進行安裝,設(shè)置基本安全性,加密HTTP客戶端通信,以及配置集群等步驟,Elasticsearch是一個開源的分布式搜索和分析引擎,適用于全文搜索、結(jié)構(gòu)化搜索、分析和可視化大規(guī)模數(shù)據(jù)
    2024-10-10
  • Linux之死鎖與解決方式

    Linux之死鎖與解決方式

    這篇文章主要介紹了Linux之死鎖與解決方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-02-02
  • ubuntu18.04安裝搜狗拼音的簡易教程

    ubuntu18.04安裝搜狗拼音的簡易教程

    這篇文章主要介紹了ubuntu18.04安裝搜狗拼音的簡易教程,非常不錯,具有參考借鑒價值,需要的朋友可以參考下
    2018-05-05

最新評論