简体   繁体   English

无法配置 nginx 反向代理

[英]Can't configure nginx reverse proxy

I'm running php+nginx api inside docker container.我在 docker 容器中运行 php+nginx api。 It is available on port 8080. I trying to add nginx reverse proxy to open api on address api.versite.online and frontend project on versite.online.它在端口 8080 上可用。我尝试添加 nginx 反向代理以打开地址 api.versite.online 上的 api 和 versite.online 上的前端项目。

I installed nginx on server, added /etc/nginx/sites-available/api.versite.online config (also added symlink to sites-enabled directory), tested config with nginx -t , restarted nginx service with systemctl reload nginx , but it had no effect.我在服务器上安装了 nginx,添加了/etc/nginx/sites-available/api.versite.online配置(还向启用站点的目录添加了符号链接),使用nginx -t测试了配置,使用systemctl reload nginx重新启动了 nginx 服务,但是它没有效果。 api.versite.online:8080 and versite.online:8080 makes request to docker container, looks like top level nginx are ignored. api.versite.online:8080 和 versite.online:8080 向 docker 容器发出请求,看起来顶级 nginx 被忽略了。 Nginx access log is empty. Nginx 访问日志为空。

/etc/nginx/sites-available/api.versite.online config /etc/nginx/sites-available/api.versite.online 配置

server {
  listen 80;
  server_name api.versite.online;

  access_log /var/log/nginx/api.versite.access.log;

  location / {
    proxy_pass http://localhost:8080;
  }
}

It seems that i forgot to add a firewall rule with sudo ufw allow 'Nginx HTTP'看来我忘了用sudo ufw allow 'Nginx HTTP'添加防火墙规则

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 Nginx 配置为 Couchdb 的反向代理 - Configure Nginx as reverse proxy for Couchdb 无法启动 nginx 反向代理的容器 - Can't start the container of a nginx reverse proxy 如何正确配置 Nginx 反向代理? - How to configure Nginx reverse proxy properly? Nginx作为Nexus的反向代理服务器 - 无法在docker环境中连接 - Nginx as reverse proxy server for Nexus - can't connect in docker environment 无法使用 docker 中的 nginx 反向代理从外部访问 - can't access from outside with nginx reverse proxy in docker docker 反向代理:无法让 jwilder/nginx 反向代理与多个桥接网络一起工作 - docker reverse proxy : can't get jwilder/nginx reverse proxy work with serveral bridge networks 如何配置IdentityServer4(DotNet Core)在Nginx反向代理中工作 - How can I configure IdentityServer4 (DotNet Core) to work in Nginx reverse proxy 无法通过 Docker 和 Nginx 代理管理器在 Nextcloud 上正确设置反向代理 Header / https - Can't get Reverse Proxy Header / https set up right on Nextcloud through Docker and Nginx Proxy Manager Docker Compose 和 Nginx 反向代理:我无法通过代理访问后端 - Docker Compose and Nginx reverse proxy: I can't access the backend through the proxy 带有 docker 的 Nginx:反向代理不起作用 - Nginx with docker: Reverse Proxy doesn't work
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM