国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項超值服

開通VIP
debian下安裝nginx+SSL
debian下安裝nginx+SSL
2010-08-31 16:30

#######################
#
#    安裝工具包
#
#######################

aptitude install build-essential

aptitude install libpcre3

aptitude install libpcre3-dev

aptitude install libpcrecpp0

aptitude install libssl-dev

aptitude install zlib1g-dev

 


#######################
#
#    添加用戶和組
#
#######################

groupadd nginx

useradd -g nginx -d /home/nginx -s /sbin/nologin nginx

 


#######################
#
# 優(yōu)化Linux內(nèi)核參數(shù)
#
#######################

vi /etc/sysctl.conf

net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 5000    65000

/sbin/sysctl -p

 


#######################
#
#      安裝nignx
#
#######################

### 具體configure配置參考看 http://wiki.codemongers.com/NginxInstallOptions ###

wget http://sysoev.ru/nginx/nginx-0.7.30.tar.gz

tar zxfv nginx-0.7.30.tar.gz

cd nginx-0.7.30

./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module

make

make install

 


#######################
#
#      運(yùn)行nignx
#
#######################

/usr/local/nginx/sbin/nginx -t

  # the configuration file /usr/local/webserver/nginx/conf/nginx.conf syntax is ok
  # the configuration file /usr/local/webserver/nginx/conf/nginx.conf was tested successfully

cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak

/usr/local/nginx/sbin/nginx

 


#######################
#
#    開機(jī)啟動nginx
#
#######################

vi /etc/rc.local

ulimit -SHn 51200
/usr/local/nginx/sbin/nginx

 


#######################
#
#      關(guān)閉nginx
#
#######################

kill `cat /usr/local/nginx/logs/nginx.pid`

 

####################################################
#
#      不停止Nginx服務(wù)的情況下平滑變更Nginx配置
#
####################################################

kill -HUP `cat /usr/local/nginx/logs/nginx.pid`

 

 

#######################
#
#   查看Nginx主進(jìn)程號
#
#######################

ps -ef | grep "nginx: master process" | grep -v "grep" | awk -F ' ' '{print $2}'

 

 

#######################
#
#       安裝SSL
#
#######################

aptitude install openssh-server

### 首先,創(chuàng)造一個key,pem 和 certificate 文件

openssl genrsa 1024 > host.key
chmod 400 host.key
openssl req -new -x509 -nodes -sha1 -days 365 -key host.key > host.cert
cat host.cert host.key > host.pem
chmod 400 host.pem

### 在nginx配置文件里加入SSL,如下:

worker_processes 1;
http {
    ...
    server {
        listen               443;
        ssl                  on;
        ssl_certificate      /path/to/host.pem;
        ssl_certificate_key /path/to/host.key;
        keepalive_timeout    70;
    }
}

 

 


#################################
#
# 每天定時切割Nginx日志的腳本
#
#################################

touch /usr/local/nginx/sbin/cut_nginx_log.sh

chmod +x /usr/local/nginx/sbin/cut_nginx_log.sh

cat >> /usr/local/nginx/sbin/cut_nginx_log.sh << "EOF"

#!/bin/bash
# This script run at 00:00

# The Nginx logs path
logs_path="/usr/local/nginx/logs/"

mkdir -p ${logs_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/
mv ${logs_path}access.log ${logs_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/access_$(date -d "yesterday" +"%Y%m%d").log
kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
EOF

### 設(shè)置crontab,每天凌晨00:00切割nginx訪問日志

crontab -e

00 00 * * * /bin/bash /usr/local/nginx/sbin/cut_nginx_log.sh

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
CentOS源碼編譯安裝Nginx
nginx做負(fù)載均衡+keepalived(做主備)
nginx安裝配置ssl模塊支持https訪問
讓你的網(wǎng)站免費(fèi)支持 HTTPS 及 Nginx 平滑升級
CentOS 7.3 安裝配置 Nginx
nginx配置ssl證書實(shí)現(xiàn)https訪問
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服