nginx 反向代理到iis

目前问题是不管访问哪个页面,显示内容都是首页,只有地址栏的链接在变

下面是我的配置截图,

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|mp4|doc|docx|ppt|pptx|xls|xlsx)$ {
    #expires 10d;
    proxy_pass http://http://127.0.0.1:8081;
}

location / {
    try_files $uri $uri/ /index.php$is_args$args;
    autoindex on;

}



location /app/ {
    if (!-e $request_filename){
        rewrite  ^/app/(.*)$  /app/public/index.php?s=/$1  last;
        break;
    }
}
#rewrite ^/(.*)$ /index.php/$1 last;
location ~ \.php$ {
    proxy_pass http://127.0.0.1:8888;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header Cookie $http_cookie;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;

    #include snippets/fastcgi-php.conf; 
    #fastcgi_pass php_upstream;        
    #fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
阅读 2.6k
1 个回答
location / {
    try_files $uri $uri/ /index.php$is_args$args;
    autoindex on;

}

这里的/index.php$is_args$args,把$uri丢掉了,所以访问只有首页。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题