在Ubuntu 14.04 64bit上安装OpenResty 1.9.7.4
生活随笔
收集整理的這篇文章主要介紹了
在Ubuntu 14.04 64bit上安装OpenResty 1.9.7.4
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
為了自己的ThinkPad T420上面的Ubuntu可以使用openresty開發,我特地記錄一下安裝過程:
安裝依賴包
apt-get install libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make build-essential下載源碼并編譯安裝
wget https://openresty.org/download/openresty-1.9.7.4.tar.gz
tar zxvf openresty-1.9.7.4.tar.gz -C ~/program_develop/
cd ~/program_develop/
cd openresty-1.9.7.4
./configure --prefix=/opt/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module
make
sudo make install
設置環境變量
vim /etc/profile
或者
vim ~/.bashrc
export PATH=/opt/openresty/nginx/sbin:$PATH
source /etc/profile
或
source ~/.bashrc
echo $PATH
查看環境變量是否設置正確?
配置文件cd ~/program
mkdir -p openresty-test openresty-test/conf openresty-test/logs
在conf目錄下面手動創建
vim nginx.conf
啟動nginx
nginx -p ~/program/openresty-test/
客戶端測試
curl http://localhost:6699 -i中途如果更改了nginx.conf,使用下面的命令來測試語法正確性
sudo nginx -p ~/program/openresty-test -t
停止
sudo nginx -p ~/program/openresty-test -s reload
需要注意的問題
與默認安裝的nginx不共存,會相互干擾,因為端口不一樣。如果安裝openresty之前系統中已經安裝有nginx,需要徹底卸載。默認安裝的nginx的配置文件在/etc/nginx/nginx.conf,可以將其服務停掉,以避免干擾
sudo service nginx stop
需要徹底刪除原有nginx相關目錄下面的所有文件。
我按照上面的方法徹底刪除nginx后,發現sudo命令下找不到nginx,只有在nginx可執行程序的那一目錄路徑下面才能使用下面的命令
sudo ./nginx -p ~/program/openresty-test/ -t
sudo ./nginx -p ~/program/openresty-test/ -s reload
第一條命令是測試配置文件是否有錯誤,第二條命令是重新加載配置文件(如果語法沒有錯誤)
參考文獻
[1].https://moonbingbing.gitbooks.io/openresty-best-practices/content/openresty/install_on_ubuntu.html
總結
以上是生活随笔為你收集整理的在Ubuntu 14.04 64bit上安装OpenResty 1.9.7.4的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: OpenResty上各种测试用例实操(1
- 下一篇: 在Ubuntu 14.04 64bit上