L
L
letema2019-07-15 17:24:35
Nginx
letema, 2019-07-15 17:24:35

How to set up nginx and php containers in kubernetes?

Good afternoon, tell me please. There is an application on Kubernetes consisting of two pods. The first is the application itself with files and dependencies, which has port 9000 open. The second is nginx, which has configmap default.conf, like this
server {
set $host_path "/var/www";
server_namelocalhost;
root $host_path;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
charset utf-8;
client_max_body_size 100M;
sendfile off;
location / {
root $host_path/web;
try_files $uri $uri/ /index.php;
index index.php;
}
location ~ \.php$ {
root $host_path/web;
set $parsed_request_uri $request_uri;
include fastcgi_params;
fastcgi_pass app:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 3000;
}
location ~* /\. {
deny all;
}
}
The error is that the site opens without css styles and js. He does not see them, although they are in the /var/www/web folder. What can be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Pugachev, 2019-07-18
@Stqs

letema ,
I have a couple of questions
1) why the section

location ~ \.php$
does it look like this? Php application because in another container
there should be something like
proxy_pass app:9000
and that's all
2) if you connect to the nginx pod and do ls -lah /var/www/web, is all the content there in place? does the folder exist?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question