Using router in php
How can I use router in php?
I tried the following code:
It return error 404 instead of
hihi
32 Replies
Project ID:
N/A
https://nixpacks.com/docs/providers/php
If aNIXPACKS_PHP_FALLBACK_PATH
variable is passed, that will be used as a fallback for the server - for instance, if your app usesindex.php
as a router, you would set this variable to/index.php
Thanks, is the link correct?
lmao nope, my bad
fixed
Thanks!
I tried using the template and I got this error message:
nginx: [emerg] directive "include" is not terminated by ";" in /app/nginx.conf:11
which points to
include $!{nginx}/conf/mime.types;
I think $!{nginx} is causing issuedid you name the conf file correctly as it is named in railways github?
but also, you don't need to modify it to achieve what you have asked
Where can I get the conf file?
Because I want to fallback at different php file for different directory
did you read this message?
Yes, I only copy this file and put it on my root directory
https://github.com/railwayapp/nixpacks/blob/main/src/providers/php/nginx.template.conf
GitHub
nixpacks/src/providers/php/nginx.template.conf at main · railwayapp...
App source + Nix packages + Docker = Image. Contribute to railwayapp/nixpacks development by creating an account on GitHub.
Is there additional files that I have to copy?
my original message says nothing about a conf file, please read the message
I understand but what I am trying to achieve is
/test/anything
will fallback to /test/index.php
that is exactly what my message explains how to do
I'm not understanding where the confusion is coming from
From my understanding, setting
NIXPACKS_PHP_FALLBACK_PATH
means everything will failback to a file if it's not found in the server right?correct
However, I only want certain directory to failback to the file, not everything
that was not clearly communicated to me until just now
That's on me, my bad
show me your conf file how you have it in your repo
I just copy this configuration file from the example repo and try to deploy it, however I couldn't get it work normally.
https://github.com/railwayapp/nixpacks/blob/main/src/providers/php/nginx.template.conf
The error I got is
nginx: [emerg] directive "include" is not terminated by ";" in /app/nginx.conf:11
GitHub
nixpacks/src/providers/php/nginx.template.conf at main · railwayapp...
App source + Nix packages + Docker = Image. Contribute to railwayapp/nixpacks development by creating an account on GitHub.
please show me your conf file how you have it in your repo
It's in the root directory
you have changed it's name
yes, I changed it to
nginx.conf
why though?
It mentioned it's supported
yes but why would you rename it?
Just to try out if it will work
it's not going to work if it's named incorrectly
I have renamed it to nginx.template.conf
I think it works