"K8s nginx php-fpm 연동"의 두 판 사이의 차이

63번째 줄: 63번째 줄:
         - name: vol-sock
         - name: vol-sock
           mountPath: /sock
           mountPath: /sock
        mountPath:
       - name: nginx
       - name: nginx
         image: nginx
         image: nginx

2021년 7월 12일 (월) 23:13 판

1 개요

k8s nginx php-fpm 유닉스 소켓 연동
php-fpm.conf
[global]
error_log = /proc/self/fd/2
log_limit = 8192
daemonize = no

[www]
access.log = /proc/self/fd/2
clear_env = no
catch_workers_output = yes

user = www-data
group = www-data
listen = /sock/php.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0666

pm = static
pm.max_children = 10
nginx.conf
location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    if (!-f $document_root$fastcgi_script_name) {
        return 404;
    }
    fastcgi_param HTTP_PROXY "";

    #fastcgi_pass 127.0.0.1:9000;
    fastcgi_pass unix:/sock/php-fpm.sock;

    fastcgi_index index.php;
    include fastcgi_params;
}
deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: php-fpm-nginx-deployment
spec:
  selector:
    matchLabels:
      app: php-fpm-nginx
  template:
    metadata:
      labels:
        app: php-fpm-nginx
    spec:
      containers:
      - name: php-fpm
        image: php-fpm
        volumeMounts:
        - name: vol-sock
          mountPath: /sock
      - name: nginx
        image: nginx
        volumeMounts:
        - name: vol-sock
          mountPath: /sock
      volumes:
      - name: vol-sock
        emptyDir: {}

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}