nginx代理背后的keystonejs

时间:2017-04-19 10:41:54

标签: nginx keystone

我得到了与nginx背后的keystonejs的堆栈。 nginx .conf:

server {
    listen       8080;
    server_name  localhost;

    location /wanghuan/ {

        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass      http://127.0.0.1:3000/;

    }

    location ~ .*\.(img|gif|jpg|jpeg|png|bmp|swf|js|css)$ {
        root   /Users/macmini/Desktop/test/wanghuan/public;
}

但是keystone admin Ui仍然阻止,静态文件无法找到, 如何设置admin ui静态文件?

2 个答案:

答案 0 :(得分:0)

您应该设置代理传递以将所有参数传递给keystone,如下所示:

upstream keystone {
  server localhost:3000
}
server {
    listen       8080;
    server_name  localhost;

    location / {

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;

    proxy_pass http://keystone;
    proxy_redirect off;

    }

    location ~ .*\.(img|gif|jpg|jpeg|png|bmp|swf|js|css)$ {
        root   /Users/macmini/Desktop/test/wanghuan/public;
}

不确定您是要尝试将所有这些放在{domain} / wanghuan还是{domain}下,但如果您想要第一个选项,只需将位置更改为/wanghuan

答案 1 :(得分:0)

您需要使用此附加选项

转换keystone.js init块
String a = Long.toString(l);

Intent clientViewIntent = new Intent(DatabaseViewer.this, 
ClientViewer.class);

clientViewIntent.putExtra("Client ID", a);
startActivity(clientViewIntent);

和您的nginx代理代码块一样简单:

'trust proxy' : true