一、安裝
1.安裝依賴
yum install pcre-devel openssl-devel gcc curl postgresql-devel
2.官網下載源碼包
http://openresty.org/cn/download.html
- 新建項目目錄結構
mkdir work
cd work
mkdir {conf,logs}
4.源碼編譯
./configure --prefix=/usr/local/openresty/ --with-http_stub_status_module --with-luajit --without-http_redis2_module --with-http_iconv_module --with-http_postgres_module --with-stream
gmake && gmake install
5.添加環境變量
vim /etc/profile
PATH=/usr/local/openresty/nginx/sbin:$PATH
export PATH
6.配置文件編寫
vim conf/nginx.conf # 內容就是nginx配置文件格式
7.啓動
nginx -p pwd
/ -c conf/nginx.conf