栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

mac上使用nginx代理

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

mac上使用nginx代理

以下内容不具有共用性。

第一步:修改host文件
sudo vim /etc/hosts
第二步:下载nginx 第三步:修改nginx的配置文件

1、修改nginx.conf文件

路径: /opt/homebrew/etc/nginx/nginx.conf

具体配置:

 
worker_processes  1; 
pid        logs/nginx.pid;
  
events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream; 
    sendfile        on;  
    keepalive_timeout  65; 
    server {
     	listen 80;
          # 域名
    	  server_name  xxx.com;
		root html;

 	    location / {
            # 设置代理服务器的地址
            # ping ip
            # telnet ip 端口
			proxy_pass http://ip:端口;
		}
      
      	location ~  .*.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css|woff|ttf|json|svg|oga|mp3|map)$ {
              # 静态文件目录
               root /opt/homebrew/Cellar/nginx/1.21.6_1/html/sp-web-sgp/static;
		}
    }
         
    include servers/*;
}

2、修改nginx的静态文件

启动nginx即可

启动服务:sudo nginx
停止服务:sudo nginx -s stop

关于nginx中的proxy_pass详解:https://blog.csdn.net/yujia_666/article/details/111595082

安装nginx参考: https://blog.csdn.net/weixin_45406712/article/details/122338225

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/962767.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号