官方网站好像没有针对suse的安装指导,自己摸索了下,记录以备后来者,新手入门,如有不对地方还请多批评指正。
1. 安装pcre。
源代码下载地址:https://ftp.pcre.org/pub/pcre/
这里选择最新版本pcre-8.43.tar.gz
具体安装命令如下(root用户)
--------------------------------------------------
#解压安装包:
tar -zxvf pcre-8.43.tar.gz
#进入安装包目录
cd pcre-8.43
#安装配置
./configure
#编译安装 如果有错误第二次编译前最好先执行 make clean命令清除上次编译目标文件
make && make install
#查看pcre版本
pcre-config --version
--------------------------------------------------
2.安装openssl。
源代码下载地址:https://www.openssl.org/source/
这里选择版本 openssl-1.1.1d.tar.gz
具体安装命令如下:
-------------------------------------
#解压安装包:
tar -zxvf openssl-1.1.1d.tar.gz
#进入安装包目录
cd openssl-1.1.1d
#安装配置
./config
#编译安装 如果有错误第二次编译前最好先执行 make clean命令清除上次编译目标文件
make && make install
------------------------------------
3.安装openrestry。
源代码下载地址:http://openresty.org/cn/download.html
这里选择页面里的openresty-1.15.8.2.tar.gz
官方说依赖 perl 5.6.1+
, libpcre
, libssl,实际suse12安装时只安装了pcre及openssl库
--------------------------------------------------
#解压安装包:
tar -zxvf openresty-1.15.8.2.tar.gz
#进入安装包目录
cd openresty-1.15.8.2
#安装配置 一般都是用默认配置
./configure
#编译安装 如果有错误第二次编译前最好先执行 make clean命令清除上次编译目标文件
make && make install
--------------------------------------------------
4.启动openrestry
------------------------------------------------------------------------------
#创建工作目录
mkdir /home/openrestry/www
cd /home/openrestry/www
#创建配置文件目录及日志目录
mkdir /conf /logs
#设置环境变量
--------------------------------------------
vi /etc/profile
#然后在profile文件后面添加如下内容:
PATH=/usr/local/openresty/nginx/sbin:$PATH
#刷新
. /etc/profile
------------------------------------------
#创建服务配置文件(照抄官方)
Create a simple plain text file named conf/nginx.conf
with the following contents in it:
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location / {
default_type text/html;
content_by_lua_block {
ngx.say("<p>hello, world</p>")
}
}
}
}
#启动
nginx -p `pwd`/ -c conf/nginx.conf
#suse启动会报错 error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
参考:https://blog.51cto.com/chaichuan/2071333 试了下增加软连接解决
ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
#测试 终端用curl命令,浏览器直接输入地址端口即可
curl http://localhost:9000/