我遇到Azure容器应用程序的主要问题,并正在考虑切换到容器的Azure应用服务。

问题描述 投票:0回答:1
upstream timed out (110: Operation timed out) while connecting to upstream, client: .... upstream: "fastcgi://localIP:9000"

您对此有任何见解吗?当FPM揭露TCP侦听器而不是HTTP时,我需要采取一些进一步的步骤吗? Thanks you in advance.

this Documentation

,您的容器应用程序不能配置为在TCP的端口443或80上专门运行。

Modify

nginx.conf
php azure azure-web-app-service azure-appservice azure-app-service-plans
1个回答
0
投票

server { listen 80; ... ... }

为nginx和php-fpm容器创建dockerfiles

enter image description here nginx(

nginx/Dockerfile

)的dockerfile


# Use lightweight Alpine Nginx FROM nginx:1.14-alpine # Set working directory WORKDIR /srv/www/app # Remove default nginx config RUN rm /etc/nginx/conf.d/default.conf # Copy Nginx config file into container COPY nginx.conf /etc/nginx/conf.d/default.conf # Expose port 80 for HTTP EXPOSE 80 # Start Nginx CMD ["nginx", "-g", "daemon off;"]

PHP/DOCKERFILE:

# Use PHP 7.2 with FPM FROM php:7.2-fpm # Set working directory WORKDIR /srv/www/app # Install dependencies RUN apt-get update -y && \ apt-get install -y \ openssl \ zip \ unzip \ git \ libmcrypt-dev # Install Composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer # Install PHP extensions RUN docker-php-ext-install pdo pdo_mysql mbstring # Expose PHP-FPM on port 9000 for TCP EXPOSE 9000 # Start PHP-FPM CMD ["php-fpm"]

NGINX/nginx.conf:

server { listen 80; server_name localhost; root /srv/www/app; index index.php; location / { try_files $uri $uri/ /index.php?$args; } location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; if (!-f $document_root$fastcgi_script_name) { return 404; } include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_pass fpm-app:9000; # Use service name fastcgi_index index.php; } }

有关更多详细信息,请参阅我和我和

git的工作。
	

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.