【问题标题】:no port in upstream "9000" in /etc/nginx/conf.d/default.conf:1/etc/nginx/conf.d/default.conf:1 中的上游“9000”中没有端口
【发布时间】:2020-05-28 10:47:26
【问题描述】:

我可以为这个错误寻求帮助吗,我运行这个命令docker run --rm -it -p 80:80 myapp/jelo:latest

nginx: [emerg] no port in upstream "9000" in /etc/nginx/conf.d/default.conf:17

这是我的 Dockerfile

FROM php:7.4-fpm-alpine
#RUN docker-php-ext-install pdo
RUN docker-php-ext-install pdo_mysql
RUN apt-get update \
   &&  apt-get install –y nginx

COPY index.php /var/www/myapp
ADD default.conf /etc/nginx/conf.d/default.conf

EXPOSE 9000
CMD ["nginx", "-g", "daemon off;"]

这是我的 default.conf

server {
        listen  80;
         index index.php;
         server_name myapp.local;
         error_log  /var/log/nginx/error.log;
         access_log /var/log/nginx/access.log;
         root /var/www/myapp;

          location / {
             try_files $uri $uri/ /index.php?$args;
           }

         location ~ \.php$ {
                 try_files $uri =404;
                 fastcgi_split_path_info ^(.+\.php)(/.+)$;
                 fastcgi_index index.php;
                 fastcgi_pass 9000;
                 include fastcgi_params;
                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                 fastcgi_param PATH_INFO $fastcgi_path_info;
             }
     }

提前谢谢你

【问题讨论】:

  • 当 nginx 启动 9000 端口不可用时,似乎 fqm 尚未侦听。

标签: docker dockerfile docker-image


【解决方案1】:

我没有看到您在端口 9000 中运行服务的位置

它应该在 dockerfile 中的某个地方,比如

php start index.php --port 9000 --background

我对php不熟悉

【讨论】:

猜你喜欢
  • 2018-08-15
  • 2020-11-08
  • 1970-01-01
  • 1970-01-01
  • 2018-04-20
  • 2016-02-08
  • 1970-01-01
  • 1970-01-01
  • 2020-11-09
相关资源
最近更新 更多