成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

編譯安裝 Nginx 1.14

shadajin / 1917人閱讀

摘要:編譯安裝所需要的等軟件不再贅述下載解壓切換到解壓后的目錄進(jìn)行配置添加組添加用戶設(shè)置用戶名設(shè)置用戶組設(shè)置安裝位置用來(lái)監(jiān)控的當(dāng)前狀態(tài)打開功能允許改變客戶端請(qǐng)求頭中或等可用于記錄客戶編譯安裝

編譯安裝所需要的gcc等軟件不再贅述
1.下載Nginx

wget http://nginx.org/download/nginx-1.14.0.tar.gz

2.解壓

tar xf nginx-1.14.0.tar.gz

3.切換到解壓后的目錄, 進(jìn)行配置

cd nginx-1.14.0

# 添加Nginx組
groupadd nginx    

# 添加Nginx用戶
useradd nginx -g nginx -s /sbin/nologin -M

./configure --user=nginx     # 設(shè)置用戶名
            --group=nginx    # 設(shè)置用戶組
            --prefix=/usr/local/nginx   # 設(shè)置安裝位置
            --with-http_stub_status_module   # 用來(lái)監(jiān)控 Nginx 的當(dāng)前狀態(tài)
            --with-http_ssl_module  # 打開HTTPS功能
            --with-http_realip_module   # 允許改變客戶端請(qǐng)求頭中X-Real-IP 或 X-Forwarded-For等, 可用于記錄客戶IP
            --with-http_gzip_static_module

4.編譯安裝

make && make install

開機(jī)啟動(dòng)和制作啟停工具

將下面的文件, 寫到/etc/init.d/nginx中

#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
#
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it"s not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/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: "
 $nginxd -s reload
    #if your nginx version is below 0.8, please use this command: "kill -HUP `cat ${nginx_pid}`"
    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

6.添加執(zhí)行權(quán)限

chmod 755 /etc/init.d/nginx

7.開機(jī)自啟動(dòng)

chkconfig --level 345 nginx on

參考文章: https://www.cnblogs.com/lucky...

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/40050.html

相關(guān)文章

  • 在OpenSUSE下編譯安裝Nginx

    摘要:準(zhǔn)備工作進(jìn)入繼續(xù)操作編譯安裝庫(kù)下載安裝高版本會(huì)出現(xiàn)錯(cuò)誤,建議選擇版本低一些,因?yàn)闀翰恢С?,可以使用版本。編譯錯(cuò)誤解決輸入命令,然后重新編譯。安裝庫(kù)下載安裝安裝解壓即可編譯安裝常用編譯選項(xiàng)說(shuō)明指定的安裝目錄。默認(rèn)情況下,該模塊沒有被構(gòu)建。 原文來(lái)自http://www.hoohack.me/2016/01/27/compile-install-nginx-in-opensuse/ 下載源...

    Soarkey 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<