在Ubuntu 14.04 64bit上安装OpenResty 1.9.7.4
2016-05-27 15:31
441 查看
为了自己的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
安装依赖包
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
相关文章推荐
- about modern operating system lecture
- 二维码推广网站
- java project 项目在 linux 下面部署步骤
- 数据排序之TopK问题
- 企业网站如何选择合适的虚拟主机?
- 编译安装 apache2.4.12
- Nginx启动报错
- 慕课linux学习笔记(九)常用命令(6)
- 给飞驰的法拉利换引擎 - 谈边做业务边做架构重构(3)—— 运筹帷幄
- linux介绍与安装
- Unix & Linux笔记(8)
- Hadoop— ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already tried 5 time(s).
- CentOS安装Nginx
- JVM监控与调优
- Scoping & Hoisting
- Linux移植【0】NandFlash无法挂在根文件系统
- centos zookeeper 实战之集群搭建
- Centos6.5安装docker
- Unix & Linux笔记(7)
- 利用SOAtest建立自动化测试验证网站是否成功加载