Can’t get php-fpm and nginx to work together in nginx

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

I tried to run php-fpm and nginx in the same pod (in different containers) .. I used an InitContainer to host the code and copy it to a volume on pod start. Then I attach the volume to both php-fpm and nginx in /var/www/html. Also I create shared volume to host the php-fpm.sock. I tried to connected them using TCP (ip:port). Here is the deployment spec. “`yaml apiVersion: apps/v1 kind: Deployment metadata: name: sso-server labels: project: secdojo app: sso-server component: auth tier: backend spec: replicas: 1 selector: matchLabels: project: secdojo app: sso-server component: auth tier: backend template: metadata: name: sso-server labels: project: secdojo app: sso-server component: auth tier: backend spec: containers: – name: php image: registry.gitlab.com/iduoad/dockerfiles/php:7.2-fpm imagePullPolicy: Always ports: – name: php-fpm containerPort: 9000 command: [“/bin/sh”, “-c”] args: [“chown -R www-data:www-data /var/www/html && php-fpm -F”] envFrom: – configMapRef: name: sso-server – secretRef: name: sso-server volumeMounts: – mountPath: “/var/www” name: code – mountPath: “/sock” name: socket – name: nginx image: registry.gitlab.com/iduoad/dockerfiles/nginx:stable imagePullPolicy: Always ports: – name: http containerPort: 80 volumeMounts: – mountPath: “/var/www” name: code # – mountPath: /etc/nginx/conf.d # name: nginx-config – mountPath: “/sock” name: socket initContainers: – name: sso-init image: [[image containing the code]] imagePullPolicy: IfNotPresent command: – cp – “-vr” – “/var/www/html” – “/code” volumeMounts: – mountPath: “/code” name: code – mountPath: “var/www/html/storage” name: oauth-keys imagePullSecrets: – name: regcred volumes: – name: code emptyDir: {} – name: nginx-config configMap: name: nginx-config – name: oauth-keys secret: secretName: oauth-keys – name: socket emptyDir: {} And he is the configuration files for both nginx and php server { listen 80; index index.php index.html; root /var/www/html/public; client_max_body_size 32M; location / { try_files $uri /index.php?$args; } location ~ .php$ { fastcgi_split_path_info ^(.+.php)(/.+)$; fastcgi_pass unix:/sock/php-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } } and this is for php-fpm error_log = /proc/self/fd/2 [www] user = www-data group = www-data listen.owner = www-data listen.group = www-data listen = /sock/php-fpm.sock pm = dynamic pm.max_children = 5 pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 3 “` You can take a look at the dockerfiles here submitted by /u/Iduoad [link] [comments]

X ITM Cloud News

Patricia

Leave a Reply

Next Post

Baptism by Fire: NS1 Insights2020 Surveys the Current Challenges of DevOps

Mon Jun 29 , 2020
Spread the love          NS1 sponsored this post. DevOps is many things: It is the need to deploy applications and updates at ever-increasing cadences. It is the necessity to shift left by integrating security processes and checks at the very beginning of the software production pipeline. But it is also critical not […]
X- ITM

Cloud Computing – Consultancy – Development – Hosting – APIs – Legacy Systems

X-ITM Technology helps our customers across the entire enterprise technology stack with differentiated industry solutions. We modernize IT, optimize data architectures, and make everything secure, scalable and orchestrated across public, private and hybrid clouds.

This image has an empty alt attribute; its file name is x-itmdc.jpg

The enterprise technology stack includes ITO; Cloud and Security Services; Applications and Industry IP; Data, Analytics and Engineering Services; and Advisory.

Watch an animation of  X-ITM‘s Enterprise Technology Stack

We combine years of experience running mission-critical systems with the latest digital innovations to deliver better business outcomes and new levels of performance, competitiveness and experiences for our customers and their stakeholders.

X-ITM invests in three key drivers of growth: People, Customers and Operational Execution.

The company’s global scale, talent and innovation platforms serve 6,000 private and public-sector clients in 70 countries.

X-ITM’s extensive partner network helps drive collaboration and leverage technology independence. The company has established more than 200 industry-leading global Partner Network relationships, including 15 strategic partners: Amazon Web Services, AT&T, Dell Technologies, Google Cloud, HCL, HP, HPE, IBM, Micro Focus, Microsoft, Oracle, PwC, SAP, ServiceNow and VMware

.

X ITM