#1.安裝依賴專案:pcre
提取碼: svgw
./configure
make &&make install#2
.安裝依賴專案:libtool
提取碼: dnd6
./configure
make &&make install#3
.安裝nginx
.直接啟動
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
/usr/local/nginx/sbin/nginx -s stop (quit) #停止nginx
/usr/local/nginx/sbin/nginx -s reload #重啟nginx#5
.將nginx設定為服務並開機啟動
定期清理日誌
cat > /usr/local/nginx/clean_nginx_logs.sh <<"
eof"
#!/bin/bash
base_path='
/usr/local/nginx/logs
'log_path=$(date -d yesterday +"
%y%m")
day=$(date -d yesterday +"
%y%m%d")
mkdir -p $base_path/$log_path
mv $base_path/access.log $base_path/$log_path/access_$day.log
mv $base_path/error.log $base_path/$log_path/error_$day.log
kill -usr1 `cat /usr/local/nginx/logs/nginx.pid`
eofchmod +x /usr/local/nginx/clean_nginx_logs.sh
加入crontab 定期執行日誌清理
執行crontab -e,加入一行
00 * * * /bin/bash /usr/local/nginx/clean_nginx_logs.sh
預設配置檔案
CentOS7 Nginx編譯安裝
需先安裝好編譯環境make,gcc和g 開發庫 yum y install gcc automake autoconf libtool make yum install gcc gcc c pcre perl compatible regular expressions perl 相容的正規表示式庫...
centos7 nginx安裝及自啟動
本文章為 wget 建立nginx的yum倉庫 root localhost conf.d rpm ivh nginx release centos 7 0.el7.ngx.noarch.rpm yum install nginx 啟動nginx服務 systemctl start nginx 檢視...
CentOS 7 Nginx 控制指令碼
傳送門 2 乾貨 相信看了準備活動,基本上就會了,這個比起下面那個方法實在是簡單多了直接上指令 sudo vi usr lib systemd system nginx.service 輸入下面內容,並儲存 unit description nginx high performance web se...