Mac安装nginx 流程配置

2021/7/2 7:23:12

本文主要是介绍Mac安装nginx 流程配置,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

http://nginx.org/en/download.html

```
mac安装 nginx

Mac:brew install nginx
```



出错提示。参考一下链接 

#### mac环境下brew command not found错误的解决方法

http://www.chenxm.cc/article/1071.html



nginx 配置文件:

Mac: /usr/local/etc/nginx/nginx.conf



```
测试配置文件格式是否正确 :nginx-t

启动: nginx

重启:nginx -s reload
```



下载完成后。

第一步:进入控制台,sudo vi /usr/local/etc/nginx/nginx.conf





进入修改 3出地方

1.修改核心

  #user  nobody;


  worker_processes  2; 

  #多核心的话就写2或者几几核


 

2.修改监听 端口号

  server {


        listen       8080;


        server_name  localhost;

   #.....

  }

3.屏蔽原有location 新增代理地址

    #location / {

​    #   root  html;

​    #   index index.html index.htm;

​    # }

​    location / {

​    proxy_pass http://localhost:8001;

​    }

​    location /api/ {

​    proxy_pass http://localhost:8000;

​    proxy_set_header Host $host;

​    }

 



这篇关于Mac安装nginx 流程配置的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程