routes wont work on nginx
Sam-Mear opened this issue Β· comments
I have migrated my first php site to tempest! (idc its not released yet, its doing a lot better than the mini framework I had originally made for it haha)
However, any route that isnt already in the public folder returns a 404 from nginx. sorry if its just a configuration error on my end, just wanted to know if it was reproducible for anyone else.
@Sam-Mear - Do you have something like the following in your config?
location / {
try_files $uri $uri/ /index.php?$query_string;
}
@aidan-casey i did not, i have added it and ran systemctl restart nginx.service and it had not fixed it. ill send you over the config file
server {
listen 80;
server_name pcpartrank www.pcpartrank;
root /var/www/html/public;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php?$query_string =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
I'm not seeing anything right off the bat that would suggest a problem to me here. Is it possible to run a tree
command within your site directory and upload the file tree?
I can try to work on documenting the set up process for Nginx soonβ’οΈ .
ignoring vendor folder here is the output
.
βββ composer.json
βββ composer.lock
βββ public
β βββ Fonts
β β βββ Ironstrike.otf
β β βββ Ironstrike_Bold.otf
β β βββ Ironstrike_Bold_Italic.otf
β β βββ Ironstrike_ExtraBold.otf
β βββ Images
β β βββ Brands
β β β βββ amd.png
β β β βββ intel.png
β β β βββ intelc.png
β β β βββ nvidia.png
β β β βββ nvidiac.png
β β βββ CpuGray.png
β β βββ CpuOrange.png
β β βββ Cpuvs2.png
β β βββ Cpuvs2.webp
β β βββ GpuGray.png
β β βββ GpuOrange.png
β β βββ HomeGray.png
β β βββ HomeOrange.png
β β βββ Logo.ico
β β βββ Logo.png
β β βββ PCPartRank.png
β β βββ Search
β β β βββ Ryzen3.png
β β β βββ Ryzen5.png
β β β βββ Ryzen7.png
β β β βββ Ryzen9.png
β β β βββ Thredripper.png
β β β βββ default.svg
β β β βββ i3.png
β β β βββ i5.png
β β β βββ i7.png
β β β βββ i9.png
β β β βββ nvida.png
β β β βββ radeon.png
β β βββ Social
β β β βββ Insta.png
β β β βββ facebook.png
β β β βββ twitter.png
β β β βββ yt.png
β β βββ background.png
β β βββ webp-test
β β βββ CpuGray.webp
β β βββ CpuGray.webpοΊZone.Identifier
β β βββ CpuOrange.webp
β β βββ CpuOrange.webpοΊZone.Identifier
β β βββ Cpuvs2.webpοΊZone.Identifier
β β βββ GpuGray.webp
β β βββ GpuGray.webpοΊZone.Identifier
β β βββ GpuOrange.webp
β β βββ GpuOrange.webpοΊZone.Identifier
β β βββ HomeGray.webp
β β βββ HomeGray.webpοΊZone.Identifier
β β βββ HomeOrange.webp
β β βββ HomeOrange.webpοΊZone.Identifier
β β βββ background.webp
β β βββ background.webpοΊZone.Identifier
β βββ Search.css
β βββ index.php
β βββ main.css
β βββ robots.txt
βββ sessions
β βββ 0ue7eugqi05db5of07as8p35um
β βββ 6fnar1ooum6d987f8gilahkvom
β βββ cgkmjffoqbvu7errl2c577porn
β βββ k819ci2m0hc4haafgho7iuv73k
β βββ peuq97fkbj3t2mlkhgchegs10s
βββ src
β βββ Code
β β βββ Controllers
β β β βββ MainController.php
β β β βββ SubController.php
β β βββ ViewModels
β β βββ HomeView.php
β β βββ SearchView.php
β βββ Data
β β βββ Backup
β β β βββ CPU_UserBenchmarks.csv
β β β βββ GPU_UserBenchmarks.csv
β β βββ CPU_UserBenchmarks.csv
β β βββ GPU_UserBenchmarks.csv
β β βββ cpu-benchmark.csv
β β βββ download.php
β β βββ error_log
β β βββ specs.js
β βββ Design
β βββ Views
β β βββ Components
β β β βββ cpu-ranking.view.php
β β β βββ gpu-ranking.view.php
β β βββ Errors
β β β βββ 404.view.php
β β βββ Search
β β β βββ found.view.php
β β β βββ no-search.view.php
β β β βββ not-found.view.php
β β βββ base.php
β β βββ cpu.view.php
β β βββ gpu.view.php
β β βββ home.view.php
β β βββ privacy.view.php
β β βββ roadmap.view.php
β β βββ search.view.php
β β βββ terms.view.php
β βββ css
β βββ main.css
βββ tempest
20 directories, 91 files
@Sam-Mear - I looked at this with a fresh set of eyes today and found the issue. π
You are adding =404
to the snippet I sent you which will always fallback to a 404 response if the file doesn't exist. You need to ensure your location block looks exactly like so:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
Thanks so much!
PCPartRank currently on tempest now!