Skip to content

Instantly share code, notes, and snippets.

@coolicer
Created November 30, 2013 02:53
Show Gist options
  • Save coolicer/7714806 to your computer and use it in GitHub Desktop.
Save coolicer/7714806 to your computer and use it in GitHub Desktop.
server {
listen 8080 default_server;
server_name 127.0.0.1;
root /home/www/php/;
index index.html index.htm index.php;
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
server {
listen 8080;
server_name www.demo.com;
root /home/www/php/www.demo.com;
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
location ~ \.php
{
#响应请求处理入口,使用php-fpm进行管理
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ .*\.(gif|jgp|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment