舒心、快乐,比什么都重要

Nginx 如何建立多个web服务 使用不同端口

复制代码
   server {
        listen       8080;
        server_name  ip;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;article/list/0/json
        location / {

            if ($request_method = 'OPTIONS') {
                return 204;
            }

            root   html/Web1;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

    }
复制代码

这假如是原本的 只需要再次建立一个 server模块  修改端口即可

 

复制代码
   server {
        listen       8081;
        server_name  ip;
  #access_log  logs/host.access.log  main;article/list/0/json
        location / {

            if ($request_method = 'OPTIONS') {
                return 204;
            }

            root   html/Web2;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

    }
复制代码

完事重启

posted @   Arcturis  阅读(247)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· 【.NET】调用本地 Deepseek 模型
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
历史上的今天:
2019-10-10 Flutter 工程报错 Failed to create provisioning profile.
2019-10-10 Flutter 布局类组件
点击右上角即可分享
微信分享提示