Geoserver NGINX配置

问题描述 投票:3回答:1

我是Nginx和EC2的新手,并尝试添加一些简单的身份验证,如下所示。这是一个单页应用程序,我想保护对页面的访问,但不能保护平铺服务器。没有身份验证,一切正常。通过下面的身份验证,我得到一个错误提示;

http://map.domain.org.uk is requesting your username and password. The site says: “GeoServer Realm”

我认为这是因为我已经为任何位置设置了身份验证,并且图块位于该位置下方。我如何设置为只要求对登陆页面进行身份验证?

server {
    listen 80;
    listen [::]:80;

    root /var/www/domain.org.uk/public_html;

    index index.html;

    server_name domain.org.uk www.domain.org.uk map.domain.org.uk;

    access_log /var/log/nginx/domain.org.uk.access.log;
    error_log /var/log/nginx/domain.org.uk.error.log;

  # auth_basic "Server level Password required to proceed";
   # auth_basic_user_file /etc/nginx/conf.d/.htpasswd;

    location /geoserver/gwc/service/wmts {
      auth_basic off;
#also tested without auth_basic off;
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://localhost:8080/geoserver/gwc/service/wmts;
    }


    location / {
        try_files $uri $uri/ =404;
    auth_basic "Location level Password required to proceed";
   auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
    }

}



amazon-ec2 geoserver nginx-location nginx-config
1个回答
0
投票

尝试运行http://localhost:8080/geoserver/wms?request=GetCapabilities

此外,我认为在这种情况下This对您有用。

这使用curl实用程序发出HTTP请求以测试身份验证。在继续操作之前,请安装curl。

另外,请检查Linode上的/etc/nginx/sites-available/example.com Here

示例

upstream appcluster{ server linode.example.com:8801; server linode.example.com:8802 weight=1; }

© www.soinside.com 2019 - 2024. All rights reserved.