Nginx rewrite / to subfolder

294
April 08, 2017, at 04:49 AM

I have a server with ISPConfig + Nginx + PHP, which sets the default webroot to /{userdir}/web. I have access to that folder only, and I cannot change the docroot in nginx.

Most frameworks use a subfolder as their docroot, for example if I install CakePHP, the docroot should be set to /{userdir}/web/webroot

But, because I cannot change the docroot, I need to make some rewrite rules in nginx which will basically change anything going to / to go into /webroot/ I tried the default rewrite rules with CakePHP, and that works fine, because they have an index.php file in the project root directory, so that maps out fine. The problem is for example when trying to access /favicon.png because of the extension, it needs to be served as a file, but there are no rewrite rules for that. Is there some magic rewrite rule, which will route everything to a subfolder as if it were the document root? Here are the default rewrite rules that CakePHP recommends: https://book.cakephp.org/3.0/en/installation.html#nginx

READ ALSO
I need some help to find an error

I need some help to find an error

I created a file with some useful PHP functions to operate with SQL databases but I have a problem with the code that inserts a record in a SQL tableWhen I try to execute this code it appear this:

162
PHP cURL - How to upload folders?

PHP cURL - How to upload folders?

I have a simple PHP script that scans an entire directory and uploads all filesBut I want it to upload the folders aswell

265
resizing images in php before uploading

resizing images in php before uploading

Hello i am new to Php and i got confuse in realizing images that post by user before uploading them

156