/etc/nginx/conf.d/default.conf:1中上游“ 9000”中没有端口

时间:2020-05-28 10:47:26

标签: docker dockerfile docker-image

我可以为此错误寻求帮助吗,我运行此命令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;
             }
     }

提前谢谢

1 个答案:

答案 0 :(得分:0)

我看不到您在9000端口中运行服务的地方

它应该在dockerfile中的某个位置,例如

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

我不熟悉php