centos 7.0 64ビットシステムインストールinx

6366 ワード

1ダウンロード
                           nginx公式サイトからhttp://nginx.org/ 新しい安定バージョンnginxをダウンロードし、linuxサーバにアップロードします。
                        2 nginxのインストールに必要な拡張
                  yum -y install pcre openssl  openssl-devel
                         3 nginxをインストールする
                         
                useradd -s /sbin/nologin www 
                tar zxvf nginx-1.8.0.tar.gz 
                cd nginx-1.8.0
                ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --without-http-cache --with-http_ssl_module  --with-pcre=/home/www/pcre-8.31 (              )
--with-http_gzip_static_module make make install
                          nginxの設定を開始します。ファイルを開始します。
                          vi /etc/init.d/inxの書き込みは、実際の状況に応じて変更されます。
                          
#!/bin/sh
#
# nginx - this script start and stop the nginx daemon
#
# chkconfig: 2345 55 25
# description: Startup script for nginx
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /var/run/nginx.pid
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
                                                   
DAEMON=/usr/local/nginx/sbin/nginx
CONFIGFILE=/usr/local/nginx/conf/nginx.conf
PIDFILE=/var/run/nginx.pid
SCRIPTNAME=/etc/init.d/nginx
LOCKFILE=/var/lock/nginx.lock
                                                   
set -e
[[ -x "$DAEMON" ]] || exit 0
                                                   
start() {
    echo "Startting Nginx......"
    [[ -x $DAEMON ]] || exit 5
    [[ -f $CONFIGFILE ]] || exit 6
    $DAEMON -c $CONFIGFILE || echo -n "Nginx already running!"
    [[ $? -eq 0 ]] && touch $LOCKFILE
}
                                                   
stop() {
    echo "Stopping Nginx......"
    MPID=`ps aux | grep nginx | awk '/master/{print $2}'`
                                                      
    if [[ "${MPID}X" != "X" ]]; then
        kill -QUIT $MPID
        [[ $? -eq 0 ]] && rm -f $LOCKFILE
    else
        echo "Nginx server is not running!"
    fi
}
                                                   
reload() {
    echo "Reloading Nginx......"
    MPID=`ps aux | grep nginx | awk '/master/{print $2}'`
                                                      
    if [[ "${MPID}X" != "X" ]]; then
        kill -HUP $MPID
    else
        echo "Nginx can't reload!"
    fi
}
                                                   
case "$1" in
start)
    start
    ;;
                                                      
stop)
    stop
    ;;
                                                      
reload)
    reload
    ;;
                                                      
restart)
    stop
    sleep 1
    start
    ;;
                                                      
*)
    echo "Usage: $SCRIPTNAME {start|stop|reload|restart}"
    exit 3
    ;;
esac
                                                   
exit 0
                       4設定起動起動
                          
        chmod 755 /etc/init.d/nginx
              chkconfig --add nginx
              chkconfig  nginx on
              /etc/init.d/nginx start  
                       5テストはブラウザで実際のドメイン名にアクセスしてみてください。正常ですか?
                       6再起動サーバーがnginxを見てランダムに起動しますか?
                       7配置に関するもの
                        
########   nginx    
location =/nginx_status {
        stub_status on;
        access_log off;
        #allow 127.0.0.1;
        #deny all;
 }
   
active connections–アクティブな接続数server accepts handed requests—は全部で11989個の接続を処理しました。1199回の握手を成功に作成しました。全部で11991個の要求reading-クライアントの接続数を読み取りました。writing-応答データがクライアントの数量waiting-keep-オープンkeep-aliveの場合、この値はactive-adingsに等しいです。Nginxはもう処理済みです。次の要求命令を待っています。