20219 月17
location /api/v1 {
set $is_matched 0;
if ($request_uri ~ /api/v1/user/100001/ ) {
proxy_pass https://127.0.0.1:1001/;
set $is_matched 1;
}
if ($request_uri ~ /api/v1/user/100002/ ) {
proxy_pass https://127.0.0.1:1001/;
set $is_matched 1;
}
# 没有匹配到,跳转到默认页面
if ($is_matched = 0) {
proxy_pass https://127.0.0.1:8080;
}
}
20168 月19
server {
listen 80;
listen 443 ssl;
if ( $scheme = "http" ) {
rewrite ^(.*) https://$host$1;
}
server_name nutzwk.wizzer.cn;
root "/java/work/nutzwk";
ssl_certificate /java/work/1_nutzwk.wizzer.cn_bundle.crt;
ssl_certificate_key /java/work/2_nutzwk.wizzer.cn.key;
add_header "X-UA-Compatible" "IE=Edge, chrome=1";
location / {
proxy_pass http://127.0.0.1:9091;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
20167 月4
location ~ \.(jpg|png|jpeg|gif)$ {
expires 30d;
root /data/www/wizzer.cn/;
}
location ~ \.(js|css)$ {
expires 2h;
root /data/www/wizzer.cn/;
}
201512 月15
CodeIgniter
php.ini 修改:
cgi.fix_pathinfo=1
nginx/vhost/ 域名配置:
server {
listen 80;
server_name www.wizzer.cn wizzer.cn;
root “/data/www/www.wizzer.cn”;
location / {
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^/(.)$ /index.php?$1 last;
break;
}
}
location ~ .php(.)$ {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
20145 月28
首先配置好运行环境:
windows下配置nginx+php环境
其次修改nginx配置文件:
server {
listen 80;
server_name localhost;
location ~ ^/bbs/.+\.php$ {
alias E:/xuetang/cn/bbs;
rewrite /bbs/(.*\.php?) /$1 break;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME E:/xuetang/cn/bbs$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/bbs($|/.*) {
alias E:/xuetang/cn/bbs/$1;
index index.php index.html index.htm;
}
location / {
root E:/xuetang/cn/www;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root E:/xuetang/cn/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
注意虚拟目录配置要在根目录上面。。