最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

CentOS下編譯安裝nginx及配置縮略圖插件的方法教程

 更新時(shí)間:2017年02月03日 10:30:43   作者:不爭(zhēng)  
這篇文章主要給大家介紹了在CentOS系統(tǒng)下編譯安裝nginx及配置縮略圖插件的方法教程,文中給出了詳細(xì)的安裝步驟,對(duì)大家具有一定的參考價(jià)值,有需要的朋友們下面來一起看看吧。

相信大家都知道利用yum安裝nginx 非常方便,但是有些插件并不會(huì)默認(rèn)安裝,比如 http_image_filter_module, 因此我們需要編譯安裝 nginx,已達(dá)到我們的目的。下面來看看詳細(xì)的方法吧。

安裝依賴

yum install -y pcre-devel libmxl2-devel libxslt-devel gd-devel

安裝 nginx

wget http://nginx.org/download/nginx-1.9.1.tar.gz
tar -xzvf nginx-1.9.1.tar.gz
cd nginx-1.9.1
./configure\
 --user=nginx\
 --group=nginx\
 --with-http_ssl_module\
 --with-http_spdy_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 
make 
make install

安裝完成后,可以使用如下命令來查看 nginx 安裝的模塊

[root@linux001 ~]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.9.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) 
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --user=nginx --group=nginx --with-http_ssl_module --with-http_spdy_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 --with-http_image_filter_module

增加啟動(dòng)腳本

新建文件 /etc/init.d/nginx , 內(nèi)容如下:

#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15 
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
#    proxy and IMAP/POP3 proxy server
# processname: nginx
# config:  /etc/nginx/nginx.conf
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
 
# Source function library.
. /etc/rc.d/init.d/functions
 
# Source networking configuration.
. /etc/sysconfig/network
 
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
 
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
 
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
 
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
 
lockfile=/var/lock/subsys/nginx
 
make_dirs() {
 # make required directories
 user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
 if [ -z "`grep $user /etc/passwd`" ]; then
  useradd -M -s /bin/nologin $user
 fi
 options=`$nginx -V 2>&1 | grep 'configure arguments:'`
 for opt in $options; do
  if [ `echo $opt | grep '.*-temp-path'` ]; then
   value=`echo $opt | cut -d "=" -f 2`
   if [ ! -d "$value" ]; then
    # echo "creating" $value
    mkdir -p $value && chown -R $user $value
   fi
  fi
 done
}
 
start() {
 [ -x $nginx ] || exit 5
 [ -f $NGINX_CONF_FILE ] || exit 6
 make_dirs
 echo -n $"Starting $prog: "
 daemon $nginx -c $NGINX_CONF_FILE
 retval=$?
 echo
 [ $retval -eq 0 ] && touch $lockfile
 return $retval
}
 
stop() {
 echo -n $"Stopping $prog: "
 killproc $prog -QUIT
 retval=$?
 echo
 [ $retval -eq 0 ] && rm -f $lockfile
 return $retval
}
 
restart() {
 #configtest || return $?
 stop
 sleep 1
 start
}
 
reload() {
 #configtest || return $?
 echo -n $"Reloading $prog: "
 killproc $nginx -HUP
 RETVAL=$?
 echo
}
 
force_reload() {
 restart
}
 
configtest() {
 $nginx -t -c $NGINX_CONF_FILE
}
 
rh_status() {
 status $prog
}
 
rh_status_q() {
 rh_status >/dev/null 2>&1
}
 
case "$1" in
 start)
  rh_status_q && exit 0
  $1
  ;;
 stop)
  rh_status_q || exit 0
  $1
  ;;
 restart|configtest)
  $1
  ;;
 reload)
  rh_status_q || exit 7
  $1
  ;;
 force-reload)
  force_reload
  ;;
 status)
  rh_status
  ;;
 condrestart|try-restart)
  rh_status_q || exit 0
   ;;
 *)
  echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
  exit 2
esac

添加好 /etc/init.d/nginx 后,需要增加執(zhí)行權(quán)限,然后就可以用腳本來 啟動(dòng)、停止 nginx 了。

chmod a+x /etc/init.d/nginx 
/etc/init.d/nginx start
/etc/init.d/nginx stop
/etc/init.d/nginx restart
/etc/init.d/nginx reload

或者以服務(wù)來 啟動(dòng)、停止 nginx。

service nginx start
service nginx stop
service nginx restart
service nginx reload

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

chkconfig --add nginx
chkconfig --level 345 on

總結(jié)

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

相關(guān)文章

  • nginx配置負(fù)載均衡的服務(wù)宕機(jī)了怎么處理

    nginx配置負(fù)載均衡的服務(wù)宕機(jī)了怎么處理

    這篇文章主要為大家介紹了nginx配置負(fù)載均衡的服務(wù)宕機(jī)的處理方法詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-06-06
  • Nginx服務(wù)器搭建和基本配置詳解

    Nginx服務(wù)器搭建和基本配置詳解

    這篇文章主要介紹了Nginx服務(wù)器搭建和基本配置詳解,Nginx是事件驅(qū)動(dòng)的高性能服務(wù)器,需要的朋友可以參考下
    2015-09-09
  • nginx,apache的alias和認(rèn)證功能

    nginx,apache的alias和認(rèn)證功能

    從年前電腦換成linux系統(tǒng)后就沒寫東西,最近有點(diǎn)懶,在這里講述下nginx alias 功能,不是server alias
    2012-11-11
  • Nginx安裝及配置詳細(xì)分析

    Nginx安裝及配置詳細(xì)分析

    這篇文章主要介紹了Nginx在各種系統(tǒng)和環(huán)境中的安裝及配置詳細(xì)分析。
    2017-11-11
  • Nginx+Tomcat群集的實(shí)現(xiàn)示例

    Nginx+Tomcat群集的實(shí)現(xiàn)示例

    這篇文章主要介紹了Nginx+Tomcat群集的實(shí)現(xiàn)示例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2024-07-07
  • Nginx 安裝詳細(xì)教程

    Nginx 安裝詳細(xì)教程

    Nginx是一款自由的、開源的、高性能的HTTP服務(wù)器和反向代理服務(wù)器,這篇文章主要介紹了Nginx 安裝詳細(xì)教程,需要的朋友可以參考下
    2020-02-02
  • Nginx的流式響應(yīng)配置實(shí)現(xiàn)小結(jié)

    Nginx的流式響應(yīng)配置實(shí)現(xiàn)小結(jié)

    nginx是一款自由的、開源的、高性能的HTTP服務(wù)器和反向代理服務(wù)器,本文主要介紹了Nginx的流式響應(yīng)配置實(shí)現(xiàn)小結(jié),具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-04-04
  • centos8中使用yum安裝nginx的詳細(xì)過程

    centos8中使用yum安裝nginx的詳細(xì)過程

    這篇文章主要介紹了centos8中怎樣使用yum安裝?nginx,centos8和centos7安裝nginx有點(diǎn)點(diǎn)不一樣,centos8?自帶了nginx?1.14.1?,我們先升級(jí)到新穩(wěn)定版1.20.1,具體安裝方法跟隨小編一起學(xué)習(xí)下吧
    2023-03-03
  • Nginx Gzip模塊啟用和配置指令詳解

    Nginx Gzip模塊啟用和配置指令詳解

    這篇文章主要介紹了Nginx Gzip模塊啟用和配置指令詳解的,需要的朋友可以參考下
    2014-04-04
  • Nginx中運(yùn)行PHP框架Laravel的配置文件分享

    Nginx中運(yùn)行PHP框架Laravel的配置文件分享

    這篇文章主要介紹了Nginx中運(yùn)行PHP框架Laravel的配置文件分享,本文直接給出配置示例,需要的朋友可以參考下
    2015-06-06

最新評(píng)論

拜泉县| 沅陵县| 临安市| 吉林市| 托里县| 安徽省| 海南省| 都江堰市| 赣州市| 手游| 泾阳县| 额济纳旗| 建宁县| 尉氏县| 车险| 开化县| 清丰县| 广汉市| 云龙县| 托克托县| 祁门县| 扶余县| 庐江县| 鄱阳县| 乐安县| 古田县| 安溪县| 玉龙| 陆川县| 长顺县| 碌曲县| 砚山县| 炎陵县| 黄梅县| 上蔡县| 望城县| 宝山区| 江川县| 丰镇市| 赤水市| 霍山县|