您的位置:首页 > 运维架构 > Nginx

nginx 配置代理和虚拟目录示例

2015-11-24 23:11 951 查看
server

{

listen 80;

server_name songaimin.xxx.cn

#index index.php index.html index.htm;

access_log /home/songaimin/job/logs/songaimin.access.log;

root /home/songaimin/job/php-prj/isou;

#root /var/www/isou;

#配置代理

location /CarOwner/{

proxy_pass http://songaimin.xxxx.cn/owner/;
#proxy_redirect off;

#proxy_set_header Host $http_host;

#proxy_set_header X-Real-IP $remote_addr;

#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Cookie $http_cookie;

}

# 配置虚拟目录

location /owner/

{

alias /home/songaimin/job/php-prj/paimai/;

index clcwsite.php index.html;

rewrite ^/owner/clcwsite.php(.*)$ /owner/clcwsite.php?s=$1 last;

rewrite ^/owner/(.*)$ /owner/clcwsite.php?s=$1 last;

break;

}

#配置php解析

location ~ ^/owner/(.+\.)(php|php5)?$

{

alias /home/songaimin/job/php-prj/paimai/;

fastcgi_param SCRIPT_FILENAME $document_root$1$2;

fastcgi_pass 127.0.0.1:9000;

include fastcgi_params;

#include fastcgi.conf;

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: