2019-01-16 18:07:30 1725次浏览 5条回答 0 悬赏 50 金钱

因为微信登陆只支持一个域名,因为某种原因只用那一个域名,想域名后面加个尾巴,比如就是 www.**.com/a 这样访问一个,再 www.**.com/b 这样再访问另一个,这个 nginx 配置弄了好久都没成功,有大佬知道具体该怎么弄吗

补充于 2019-01-16 18:54
server {
        listen       80;
        server_name lztg.com;
        index  index.php index.html index.htm;
        set $DOCROOT "D:\work\lztg\web";

		  location /tg {
			root   D:/work/lztg/web;
			try_files $uri $uri/ /index.php?$args;
			index index.php;

		  }
		  
		location ~ \.php(.*)$ {
			root $DOCROOT;
			include fastcgi_params;
			fastcgi_param SCRIPT_FILENAME $DOCROOT$fastcgi_script_name;
			fastcgi_pass backend;
			fastcgi_index index.php;
       }
}

这样配置了一下 访问 http://lztg.com/tg/ 之后 出 404 页面 有大佬知道的吗

补充于 2019-01-17 11:44

我的a和b都是虚拟的目录 实际不存在

  • 回答于 2019-01-17 11:40 举报

    我的项目路劲如下

    /data/wwwroot/test1/index.php
    /data/wwwroot/test2/test2/index.php
    
    location /test1 {
        root /data/wwwroot;
        fastcgi_pass $fast_cgi_sock;
        fastcgi_index index.php;
        include fastcgi.conf;
    }   
    
    location /test2 {
        root /data/wwwroot/test2;
        fastcgi_pass $fast_cgi_sock;
        fastcgi_index index.php;
        include fastcgi.conf;
    #   echo $document_root$fastcgi_script_name;
    #   echo $document_root;
    #   echo $fastcgi_script_name;
    }
    
  • 回答于 2019-01-17 13:38 举报

    没有问题,原理上应该可以,我没看出不可以的。所以,你再看看是哪里缺少东西了,重启了没有。或者具体配置项。这个很有意思。

  • 回答于 2019-01-17 17:02 举报

    可以通过 路由来解决

  • 回答于 2019-01-18 18:52 举报

    通过参数的判断,rewrite到你想去的目录就可以了

  • 回答于 2019-01-26 12:47 举报

    不能加不同的入口目录吗,也在一个域名下的,像backend/fontend/api,再加一个a b ... 这样行不行?

您需要登录后才可以回答。登录 | 立即注册
汤亚兵
总监

汤亚兵 湖北黄冈

注册时间:2019-01-08
最后登录:2019-06-19
在线时长:39小时27分
  • 粉丝2
  • 金钱1865
  • 威望10
  • 积分2355

热门问题