如何配置Nginx反向代理

时间:2018-08-01 03:49:44

标签: nginx

我想通过我的域名访问http://serverIP:9000/projects。我试图这样写配置文件

server {
    listen 80;
    server_name xxx.xxx.com;
    location / {
        proxy_pass http://myserverip:9000/projects;
    }
}

还有这个

server {
    listen 80;
    server_name xxx.xxx.com;
    client_max_body_size 90m;
    client_body_timeout  20m;

    location / {
        proxy_pass http://myserverip:9000/projects;
        proxy_set_header Host      $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

}

,但它仍然无法访问http://myserverip:9000/projects。我应该如何写配置文件以使其正确。谢谢!

1 个答案:

答案 0 :(得分:0)

您可以使用:

    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_GET_CONTENT);
    intent.setType("file/*");
    //intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);// even this does not work
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);

但是请确保CSS的路径适合此。

或:

proxy_redirect http://xxx.xxx.com http://myserverip:9000/projects;
proxy_redirect off;
server_name_in_redirect off;

然后您可以访问:proxy_pass http://myserverip:9000/;