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;
}
}
{
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;
}
}
相关文章推荐
- 统计nginx某个请求
- Nginx性能优化
- nginx转发配置shipyard遇到的问题
- Nginx模块管理和进程管理
- nginx正则
- Nginx后端节点健康检查
- 在ubuntu上安装nginx
- Nginx绑定域名 nginx绑定多个域名
- nginx 学习笔记(二) --- 调试
- nginx 配置
- nginx 学习笔记(一) --- 安装和启动
- [Nginx] nginx提示:500 Internal Server Error错误的解决方法
- nginx配置详解
- NGINX使用笔记
- nginx日志access.log error.log按天生成存储,定时删除日志
- Nginx 配置 location 总结及 rewrite 规则写法
- nginx部署安装
- unbuntu14.04 安装nginx配置
- 如何正确配置Nginx+PHP
- centos源码安装nginx