nginx - 使用 Nginx 的 localhost 上的子域

标签 nginx

我想捕获project1.localhost,这是我尝试过的conf,但它没有捕获任何内容。

server {
       listen 80;

       server_name project.localhost;

       location / {
                proxy_pass      http://127.0.0.1:3000/;
        }
}

最佳答案

添加行 127.0.0.1 项目.localhost 到您的主机文件(*nix 中的/etc/hosts)。

关于nginx - 使用 Nginx 的 localhost 上的子域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15823003/

相关文章:

Nginx RTMP Module 接收 x.264 ,输出 HLS 直播流

Docker镜像: Unable to configure HTTPS endpoint.没有指定服务器证书,找不到默认的开发者证书

python - Nginx WebSocket 代理不断获取 HTTP 301 重定向

node.js - Express + Passport + Nginx - 仅在实时环境中 req.user 为空

angular - 如何使用单个服务人员安装多语言 Angular PWA?

linux - .NET Core 应用程序可以在仅安装 .NET Core 的服务器上运行吗?

python - Django 使用 'python manage.py' runserver 代替 Gunicorn

ruby-on-rails - 如何使用Nginx/Passenger服务多个站点?

nginx - docker上的nginx不适用于位置URL

Nginx 301重定向自定义页面不起作用,仍然返回其中包含 "nginx"的页面