I'm using the Nginx1.9.9,laravel 5.1.11 version.
Project many people will feel, localhost under a pile of folders a pile of items, each time a new project is accustomed to directly under the site root directory, after all, in the local development debugging, how convenient how to come.
So I have a lot of things in localhost, http://localhost/asd/, or http://localhost/caugoo/similar to many, but now a lot of PHP framework to a route, configure a URL rewrite, Under Apache is very convenient, but under the nginx will be a few more.
Take my new project as an example, the project requires Laravel to do, so I threw the whole project into a folder called Laravel, the directory becomes C:/nginx/html/laravel, and then found only through localhost/laravel/ Public to access, after all, Laravel's entry file index.php in public.
Find a Find Laravel root directory server.php can also achieve this effect, the server.php renamed to Index.php, and then in Nginx that configuration file plus the following code, the successful URL rewrite to this index.php ...
Similarly, the configuration of other frameworks under Nginx is similar, such as thinkphp, and do not need to change what server.php file, because thinkphp these framework root directory is index.php.
location/laravel/{ index index.html index.htm index.php; if (!-e $request _filename) { rewrite ^/laravel/(. *) $ /laravel/index.php?s=$1 last ; } }
The above describes the Nginx Laravel in the site Directory of the two-level directory URL rewrite method, including the content, I hope that the PHP tutorial interested in a friend helpful.