Laravel in a sub-directory using NGINX with preserved routing
You need to set dynamicaly and change the fastcgi_param REQUEST_URI $request_url.
Basically to remove or add (depend on your needs) the word /shop from the REQUEST_URI
You may need to remove REQUEST_URI from fastcgi_params file.
More info and example can found in
https://serverfault.com/questions/697569/rewrite-url-with-fastcgi-in-nginx
I didn't tested it so maybe some changes need to made in some lines or change the order of things...
but you can try to use something like
location /shop {
alias /var/www/shop/public;
try_files $uri $uri/ @shop;
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param REQUEST_URI /shop$request_uri;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
location @shop {
rewrite /shop/(.*)$ /shop/index.php last;
}
nginx: how to serve file from a subfolder of root?
Fixed adding
location /fonts {
root /var/www/prod.revisions;
}
Related Topics
How to Add/Set Images on PHPoffice/Phpword Template
How to Access Magento Customer's Session from Outside Magento
How to Run PHP File Using Cron Jobs
Codeigniter 4 Problem Installing with Composer
How to Prevent PHP Script Running More Than Once
PHP Flush() Not Working in Chrome
PHP MySQL Query Where X = $Variable
How to Rename a Filename After Uploading with PHP
Programmatically Create Image from Web-Page or a Single Div
PHP Looping Through Multiple Arrays
Woocommerce Cart Quantity Base Discount
Wordpress Paginate_Links - How to Use It
Php: Fastest Way to Check for Invalid Characters (All But A-Z, A-Z, 0-9, #, -, ., $)
(When) Should I Use Type Hinting in PHP
Php, Add a Newline with Implode
PHP Explode Array Then Loop Through Values and Output to Variable