openresty安裝配置,
安裝openresty需要的庫 apt-get install libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make build-essential 構建 OpenResty進入下載好的壓縮包檔案中用下面的命令進行解壓 VERSION 為當前openresty的版本tar -xzvf openresty-VERSION.tar.gz 然後在進入 openresty-VERSION/ 目錄, 然後輸入以下命令配置(預設配置安裝):./configure 編譯安裝下面命令進行編譯make下面的命令安裝 OpenResty到系統之中make install此時,我的系統中已經安裝好了Openresty,因為在配置時使用了預設安裝路徑,所以我的程式被安裝到了:/usr/local/openresty/中,該檔案夾中包含了luajit、lualib、nginx三個目錄。openresty的設定檔預設是在 /usr/local/openresty/nginx/conf
運行nginx進入目錄,執行./nginx
沒報錯就運行起來了執行nginx -V 查看nginx 版本資訊 停止服務:
nginx -s reload :修改配置後重新載入生效nginx -s reopen :重新開啟記錄檔nginx -t -c /path/to/nginx.conf 測試nginx設定檔是否正確關閉nginx:nginx -s stop :快速停止nginx quit :完整有序的停止nginx其他的停止nginx 方式:ps -ef | grep nginxkill -QUIT 主進程號 :從容停止Nginxkill -TERM 主進程號 :快速停止Nginxpkill -9 nginx :強制停止Nginx啟動nginx:nginx -c /path/to/nginx.conf平滑重啟nginx:kill -HUP 主進程號
啟動服務
通過下述方式啟動Nginx。如果沒有任何輸出,說明啟動成功,-p 指定我們的項目目錄,-c 指定設定檔。/usr/local/openresty/nginx/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf/usr/local/openresty/nginx/sbin/nginx -p 'pwd' -c /usr/local/openresty/nginx/conf/nginx.conf為openresty下的nginx建立軟鏈(非必需)ln -s /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx則可使用如下方式啟動/usr/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf
安裝成功
1、/usr/local/openresty/site/lualib裡添加 resty和cjson的引用
問題解決:The program 'nginx' can be found in the following packages:
* nginx-extras
* nginx-full
* nginx-light
Try: apt-get install <selected package> 開始我以為是我的nginx安裝錯了,然後找各種教程仔細看安裝步驟,覺得沒有問題啊,折騰好久不知道該怎麼辦,最好在網友的提示下仔細看了提示,然後按照提示繼續做,即:
apt-get install nginx-extras 斷行符號apt-get install nginx-full 斷行符號apt-get install nginx-light斷行符號