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