Nginx 安装
快速安装
Ngnix官网地址:http://nginx.org/
使用OpenResty对Nginx实现扩展。https://openresty.org/cn/
安装步骤
-
下载源码包,并解压。详细命令如下:
wget http://nginx.org/download/nginx-1.15.3.tar.gz
tar zxvf nginx-1.15.3.tar.gz
-
安装依赖:pcre、openssl、lua和编译工具:gcc。详细命令如下:
yum install -y pcre pcre-devel
yum install -y openssl openssl-devel
yum install -y lua lua-devel
yum install -y gcc
- 注:LuaJIT与Lua均可以(配置依赖分别为--with-luajit… 和--with-lua…,模块使用一致),但LuaJIT效率比Lua高。LuaJIT安装见官网:http://luajit.org/
-
进源码目录
cd nginx-1.15.3
,配置nignx。- 文档地址:http://nginx.org/en/docs/conf...。使用` ./configure --help
`查看参数说明,翻译见:https://www.jianshu.com/p/f46...
* 命令示例
```sh
./configure \
--with-http_lua_module \
--with-lua-lib=/usr/lib64 \
--with-lua-inc=/usr/include \
--with-stream \
--with-stream_ssl_module
```
* 注:yum 安装默认在/usr/lib64 和/usr/include,可以使用 `rpm -ql pcre-devel`,`rpm -ql lua-devel` 查看相关文件。
* 运行结果示例:
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx modules path: "/usr/local/nginx/modules"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
-
编译并安装。
- make
- make install
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。