域名制定目录到不同的IP

假设同一台服务器有三个网站 A,B,C
但只有一个域名www.abc.com

期望:
访问www.abc.com/a可以访问A网站的内容,
访问www.abc.com/b可以访问B网站的内容,
访问www.abc.com/c可以访问C网站的内容,
以此类推...

Nginx应该怎么配置呢?

我的Nginx是这样配置的,但是不能达到想要的效果:(

 
location /a {
    root /path/to/web/a;
    try_files $uri $uri/ /index.php;
}

location /b {
    root /path/to/web/b;
    try_files $uri $uri/ /index.php;
}

location /c {
    root /path/to/web/c;
    try_files $uri $uri/ /index.php;
}

location ~ .*\.php? {
    include                   fastcgi_params;
    fastcgi_param             SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_intercept_errors  on;
    fastcgi_pass              127.0.0.1:900;
}
posted @ 2018-10-26 15:59  知者认知  阅读(185)  评论(0编辑  收藏  举报