Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
stop68673yDo you mean:
example.com/ -> lavarel
example.com/bla -> wordpress
This case is in the docs: https://nginx.org/en/docs/... -
So far i had only one usecase which ngnix couldn't solve - proxy rules for udp traffic. For all regular web routing, caching, proxy problems nginx answer has been yes.
-
Wombat105823y@Avimelekh I've spent hours trying to only catch example.com/ and specify the Laravel root for it. All my efforts ended in 403 or 404 or just the WordPress site... 😭
-
stop68673y@Wombat it should look like this:
location = / {
root /lvarelroot; # filesystem path
fastcgi_param SCRIPT_FILENAME /lavarelindex.php; # filesystempath
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass fpm;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location / {
[fastcgi config wordpress]
} -
https://google.com/amp/s/...
Scroll to location block, regex should solve your problem. Issues will a rise from pathing after first slash, for example if both apps have same path, i would seperate these two, by giving some prefix for each using rewrite in nginx. However rewrite will introduce you to new redirection problems, which mostly can be solved but can become tricky. -
Did you manage to get it working?
I have a similar wcnario where root route goes to www folder and API route go to a docker container.
If you still didn't get it working let me know I'll share my config. It's just I'm not near my laptop to share now 😅 -
@Wombat This is the config I use: https://pastebin.com/fpv5Lth5
It redirects to three docker containers and one statically served web page. It should be the same in your case, if you are not using containers then I assume you need to set root in each block.
Related Rants
-
ScaryException16WordPress has really cool features! You can uninstall it, for example.
-
Desinika20Yesterday's JR web dev interview: 👨🏻💻: Experience? 👶: Well JS, pyhton, UX Design and bit of Sa...
-
tahnik21OW FUCKING GREAT BEEN CREATING THIS WEBSITE FOR 1 MONTH USING REACTJS. IT'S HALFWAY DONE. NOW THE HIGHER UPS ...
I have an nginx question.
Is it possible to send example.com/ requests to a Laravel app and send all other requests to an WordPress app?
question
wordpress
nginx
laravel