Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

phpfpm static files 404 #16

Open
luxarbt opened this issue May 26, 2019 · 10 comments
Open

phpfpm static files 404 #16

luxarbt opened this issue May 26, 2019 · 10 comments

Comments

@luxarbt
Copy link

luxarbt commented May 26, 2019

Can't access to static files, every files are in 404 and served as text/html

@alemorcuq
Copy link

Hi, @allrib.

Could you please provide some steps in order to reproduce the issue?

Regards,
Alejandro

@luxarbt
Copy link
Author

luxarbt commented May 27, 2019

Hi @alemorcuq

I followed step by step this tutorial : https://docs.bitnami.com/kubernetes/how-to/deploy-php-application-kubernetes-helm/ .

When I attach a simple css file like that in php file :

My PHP file is 200 OK.
My CSS, JS are in 404 error.

Regards,
Alexis

@alemorcuq
Copy link

Hi, @allrib,

In which step of the tutorial does it happen? Are you building the docker image again after attaching your files?

@luxarbt
Copy link
Author

luxarbt commented May 27, 2019

@alemorcuq

The problem is at the end of tutorials,

I did docker build . -t MYUSERNAME/phpfpm-app:0.1.0 in tutorials/phpfpm-k8s/ after attaching my files
and I launched helm install --set mariadb.mariadbRootPassword=DB_ROOTPASSWORD,mariadb.mariadbUser=DB_USERNAME,mariadb.mariadbPassword=DB_USERPASSWORD,mariadb.mariadbDatabase=DB_NAME --name phpfpm .

When I go to http://IP:PORT I get for example version.php 200 OK and test.css, test.js error 404

@luxarbt
Copy link
Author

luxarbt commented May 28, 2019

@alemorcuq

Another problem I think : css, jss files are finally served as text/html. Even though I obtain an error 200 on my statics files, they are interpreted as text/html.
Can you take a look on that ?

Regards,

Alexis

@alemorcuq
Copy link

Hi, @allrib.

Static files need to be mounted to the nginx container and not to the php-fpm one. If you look at the nginx.conf. Looking at the nginx.conf file:

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

    root /app;

    location / {
        index index.php;
    }

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

You will have to mount your static files to the /app directory of your nginx container.

@zetas
Copy link

zetas commented Nov 25, 2019

You will have to mount your static files to the /app directory of your nginx container.

@alemorcuq Any idea how to do that?

@alemorcuq
Copy link

You will have to mount your static files to the /app directory of your nginx container.

@alemorcuq Any idea how to do that?

How are you deploying Nginx?

@iamamjad
Copy link

iamamjad commented Mar 15, 2020

helm install --set mariadb.mariadbRootPassword=DB_ROOTPASSWORD,mariadb.mariadbUser=DB_USERNAME,mariadb.mariadbPassword=DB_USERPASSWORD,mariadb.mariadbDatabase=DB_NAME --name phpfpm .

when i enter this command it give me the following error

Error:unknown flag --name

@carrodher
Copy link
Contributor

carrodher commented Mar 16, 2020

--name is not a valid flag in Helm 3, if you are using Helm 3 you don't need to use this flag, only provide the chart name:

  • Random name:
▶ helm2 install .
▶ helm3 install --generated-name .
  • Defined name:
▶ helm2 install --name phpfpm .
▶ helm3 install phpfpm .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants