-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Exposing FastCGI Servers and change webroot from /var/www/html to /var/www/html/public #4822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Closing. Please check https://kubernetes.github.io/ingress-nginx/user-guide/fcgi-services/ |
thanks @aledbf ! I have already checked that documentation, and it had no direct comment on which other directives could be changed using configmap. For future references, I added:
And it changed that. But still not working, probably because of other FastCGI params. Where can I find which can I change using configmap? For example if I need to change
|
And how about the location? For example this is what I got in the
I want that Thanks!! |
There is no documentation for that. You can set any fastcgi_param defined in the nginx manual https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/ Edit: the FastCGI feature just mirrors what nginx provides. If you already are using nginx to expose the php app you should just add those settings in the configmap |
Why? Unless you have other routes in the ingress, doing that change means only .php URLs will work and any other will get 404. |
No. If you need to change fastcgi settings I suggest you use the configuration snippet annotation https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#configuration-snippet |
Thank @aledbf !! You saved our day! One last thing, now we are getting 404 on trying to access files that are actually there. In our local nginx custom deploy we have the following modified in the default.conf
How could we address that? We get
On the php FastCGI pod, even when that file (and others) are there. Thanks again!! |
If you see that output in the log, it means the php app is returning 404. |
|
and could it be the fact that the FastCGI annotations are messing with that ability to serve other URLs or not? |
|
@agustin-caylent from that output is clear the PHP FastCGI configuration only process PHP files (which makes sense). I think you should add (again) nginx in your app but only to serve the static assets. That said, I prefer to serve static assets using Cloudfront (from an S3 bucket) in a subdomain, avoiding this traffic in the cluster. (In general, FastCGI or not) |
Yes, moving statics to S3 + CDN is on the plan, and we will do. This was SUPER helpful, thanks much @aledbf !! |
@agustin-caylent You save you root content in php-fpm pod? |
@agustin-caylent Hey bro, did you manage to get laravel working with the config? I've been trying for the past 2 days to bypass our nginx container with ingress controller FCGI straightaway but I still got 404 from nginx.. no logs form the pods at all Mind sharing working config from your app? here's mine that's not working:
|
Have you managed to make it work ? I am still unable.. (#8207) |
Is this a request for help? No
What keywords did you search in NGINX Ingress controller issues before filing this one? fcgi root /var/www/html
Is this a BUG REPORT or FEATURE REQUEST? (choose one): FEATURE REQUEST
Using annotations described here https://kubernetes.github.io/ingress-nginx/user-guide/fcgi-services/ we were able to get the traffic to the php pod. However, we need the root changed from "/var/www/html" to "/var/www/html/public".
NGINX Ingress controller version: "0.26.1"
Kubernetes version (use
kubectl version
): "1.14"Environment: production (migrating to kubernetes)
uname -a
): "Linux php-689789df4b-scgpb 4.14.152-127.182.amzn2.x86_64 Basic structure #1 SMP Thu Nov 14 17:32:43 UTC 2019 x86_64 GNU/Linux"What happened:
Traffic gets routed to our php pod, while putting annotations and configmap for FGCI, but we need to change the default nginx root from "/var/www/html" to "/var/www/html/public" in order to have the application working properly.
What you expected to happen:
To change the nginx root to ""/var/www/html" to "/var/www/html/public".
How to reproduce it (as minimally and precisely as possible):
We can deploy our application locally manually deploying an nginx docker image, and modify the FCGI in the "/etc/nginx/conf.d/default.conf" as well as "root /var/www/html/public;"
Anything else we need to know:
We tried with annotations such as nginx.ingress.kubernetes.io/rewrite-target or nginx.ingress.kubernetes.io/app-root but neither of these seem to get along well with the FGCI annotations
The text was updated successfully, but these errors were encountered: