Last active
January 1, 2016 14:19
-
-
Save coolicer/8157121 to your computer and use it in GitHub Desktop.
Thinkphp3.2 URL Rewrite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 8080; | |
| root /home/www/; | |
| index index.html index.htm index.php; | |
| server_name localhost; | |
| location ~ \.php$ { | |
| fastcgi_split_path_info ^(.+\.php)(.*)$; | |
| fastcgi_pass unix:/var/run/php5-fpm.sock; | |
| fastcgi_index index.php; | |
| include fastcgi_params; | |
| } | |
| } | |
| server { | |
| listen 8080; | |
| server_name demo.com www.demo.com; | |
| root /home/www/php/tp/; | |
| index index.html index.htm index.php; | |
| location / { | |
| if (!-e $request_filename) { | |
| rewrite ^/(.*)$ /index.php/$1 last; | |
| break; | |
| } | |
| } | |
| location ~ .+\.php($|/) { | |
| set $script $uri; | |
| set $path_info "/"; | |
| if ($uri ~ "^(.+\.php)(/.+)") { | |
| set $script $1; | |
| set $path_info $2; | |
| } | |
| fastcgi_pass unix:/var/run/php5-fpm.sock; | |
| fastcgi_index index.php?IF_REWRITE=1; | |
| include fastcgi_params; | |
| fastcgi_param PATH_INFO $path_info; | |
| fastcgi_param SCRIPT_FILENAME $document_root/$script; | |
| fastcgi_param SCRIPT_NAME $script; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment