Fork me on GitHub

openresty nginx

安装openresty nginx

命令

install openresty/brew/openresty```
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

之后当前目录下创建`mkdir ~/work cd ~/work mkdir logs/ conf/`

在conf 下创建nginx.conf 配置文件,默认的配置文件在`/usr/local/etc/openresty/nginx.conf` 默认的端口80

`nginx -s reload nginx -h nginx -p nginx -c `

nginx.conf 配置文件内容

配置这个反向服务代理要代理的服务器集群
<!-- more -->

``` shell
upstream backend_server {
server localhost:8080 weight=1;
}

server{
listen 7777;
location / {
proxy_pass http://backend_server ;
}
#当用户访问这个目录下文件,即认为在访问静态资源
location /resources {
alias //usr/local/opt/openresty/nginx/html;
}
}

本文欢迎转载,但是希望注明出处并给出原文链接。 如果你有任何疑问,欢迎在下方评论区留言,我会尽快答复。 如果你喜欢或者不喜欢这篇文章,欢迎你发邮件到 alonecong@126.com 告诉我你的想法,你的建议对我非常重要。

------ 本文结束感谢您的阅读! ------
0%