Last active
August 29, 2015 14:08
-
-
Save iflamed/52e07ef4704ce79320e7 to your computer and use it in GitHub Desktop.
one nginx server and multiple app(folder) share one fastcgi
This file contains 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
## | |
# also you can seprate the php's fastcgi configration,then integrate to the test.example.com.conf | |
## | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
## NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini | |
# With php5-cgi alone: | |
#fastcgi_pass 127.0.0.1:9000; | |
## With php5-fpm: | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} |
This file contains 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{ | |
server_name test.example.com; | |
access_log /var/log/nginx/test.example.com_access.log; | |
error_log /var/log/nginx/test.example.com_error.log; | |
index index.php; | |
root /home/pi/project/test; | |
location / { | |
## | |
# it's compatible with thinkphp pathinfo mode | |
## | |
if (!-e $request_filename){ | |
rewrite ^(.*)$ /index.php?s=$1 last; | |
break; | |
} | |
} | |
location /app { | |
alias /home/pi/project/test/laravel/public/; | |
## | |
# the app path at the location and the rewrite below must be the same | |
## | |
if (!-f $request_filename){ | |
rewrite ^(.*)$ /app/index.php?$query_string; | |
} | |
location ~ \.php { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
## | |
# the default php fastcgi,it's compatible with thinkphp and laravel those i have test. | |
## | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
## NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini | |
# With php5-cgi alone: | |
#fastcgi_pass 127.0.0.1:9000; | |
## With php5-fpm: | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment