Error 403 JS/CSS file using bitnami configuration for nginx kubernetes deployment

5/25/2019

I'm using bitnami repository for deploying a php application using kubernetes-helm.

There is something wrong, nginx does not serve correctly css and js files. I'm using php-fpm

php files are always returning 200, everything is ok. but css and js error 403.

This is my vhost file :

server {
    listen 0.0.0.0:80;
    server_name myapp.com;

    root /app;

    location / {
        include /opt/bitnami/nginx/conf/mime.types;
        try_files $uri $uri/index.php;
    }

    location ~ \.php$ {
        # fastcgi_pass [PHP_FPM_LINK_NAME]:9000;
        fastcgi_pass phpfpm:9000;
        fastcgi_index index.php;
        include fastcgi.conf;
    }
}

I tried everything like chmod, chown etc... I can't deal with that

Update : my values.yaml

# Default values for phpfpm-app.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
  repository: alexisribot/phpfpm-app
  tag: 0.1.0
  pullPolicy: IfNotPresent
nginxService:
  name: nginx
  type: NodePort
  externalPort: 80
  internalPort: 8080
phpfpmService:
  name: phpfpm
  type: NodePort
  phpfpmPort: 9000
ingress:
  enabled: false
  # Used to create Ingress record (should used with service.type: ClusterIP).
  hosts:
    - chart-example.local
  annotations:
    # kubernetes.io/ingress.class: nginx
    # kubernetes.io/tls-acme: "true"
  tls:
    # Secrets must be manually created in the namespace.
    # - secretName: chart-example-tls
    #   hosts:
    #     - chart-example.local
config:
  nginx.conf: |-
    server {
      listen 0.0.0.0:8080;
      root /app;
      location / {
        try_files $uri $uri/index.php;
      }
      location ~ \.php$ {
        fastcgi_pass phpfpm-php-app-phpfpm:9000;
        fastcgi_index index.php;
        include fastcgi.conf;
      }
    }
resources:
  limits:
    cpu: 100m
    memory: 128Mi
  requests:
    cpu: 100m
    memory: 128Mi
-- alexis
bitnami
kubernetes
kubernetes-helm
nginx

0 Answers