nginx i.com.conf

server {

listen 9090;

server_name i.com;

root /Users/chong/Documents/www;

# Load configuration files for the default server block.

location / {

index index.php index.html index.htm;


if (!-e $request_filename) {

#rewrite ^/index.php(.*)$ /index.php?s=$1 last;

#rewrite ^/admin.php(.*)$ /admin.php?s=$1 last;

#rewrite ^(.*)$ /index.php?s=$1 last;

#rewrite ^(.*)$ /admin.php?s=$1 last;

#rewrite '^/admin.php(.*)$' /data.txt last;

#rewrite ^/images/(.*)_(d+)x(d+).(png|jpg|gif)$ /data.txt last;

rewrite ^/php/midou/admin.php(.*)$ /php/midou/admin.php?s=$1 last; #ok...

#rewrite ^/(.*) http://xy2.163.com permanent; #ok...

break;

}


autoindex on;

autoindex_exact_size on;

autoindex_localtime on;

}

location ~* .php$ {

fastcgi_index index.php;

fastcgi_pass 127.0.0.1:9001;

include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;

}

error_page 404 /404.html;

location = /40x.html {

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

}

}

server {

listen 9090;

server_name i.com;

root /Users/chong/Documents/www;

# Load configuration files for the default server block.

location / {

index index.php index.html index.htm;


if (!-e $request_filename) {

rewrite ^/(.*)/index.php(.*)$ /$1/index.php?s=$2 last;

rewrite ^/(.*)/admin.php(.*)$ /$1/admin.php?s=$2 last; #ok...

#rewrite ^/(.*) http://xy2.163.com permanent; #ok...

break;

}


autoindex on;

autoindex_exact_size on;

autoindex_localtime on;

}

location ~* .php$ {

fastcgi_index index.php;

fastcgi_pass 127.0.0.1:9001;

include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;

}

error_page 404 /404.html;

location = /40x.html {

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

}

}

补充:

代理对文件大小的限制,

server {
client_max_body_size 100M;
listen 9096;
server_name gate.chaohuoyy.com;

location / {
proxy_pass http://127.0.0.1/data/index.html;
}

location /svn {
proxy_pass http://192.168.1.95:8080/svn;
}

}

原文地址:https://www.cnblogs.com/xingchong/p/8489900.html