2017-04-12 19 views
0

내 nginx 설정과 관련하여 약간의 문제가 있습니다. 하나의 중앙 서버를 프록시로 사용하여 네트워크에서 다중을 만들 계획입니다.NGNIX Nextcloud URL 리디렉션 실패에 대한 역방향 프록시

      |---(/nextcloud/)--->Nextcloud-Server 
-----> Central-Server--->| 
         |---(/git)---------->Git-Server 
         | 
         |---(/Redmine)---------->Redmine-Server 

URL 리디렉션이 제대로 작동하지 않아 어떤 이유로 Nextcloud Server에서이 설정을 시작했습니다. 몇 가지 리디렉션 및 다시 쓰기 규칙을 사용하려고했지만 작동시키지 못했습니다.

위치에 액세스 할 때마다 항상 중앙 서버로 리디렉션됩니다. 따라서 domain.net/nextcloud/는 domain.net/login으로 리디렉션되지만 실제로 domain.net/nextcloud/login에 액세스해야합니다. 누구든지이 솔루션을 가지고 있습니까? 나의 현재 설정은 그냥 당신이 선택 할 자식 서버 다음 클라우드에 대한

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
    # 
    #location ~ \.php$ { 
    # root   html; 
    # fastcgi_pass 127.0.0.1:9000; 
    # fastcgi_index index.php; 
    # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 
    # include  fastcgi_params; 
    #} 

    # deny access to .htaccess files, if Apache's document root 
    # concurs with nginx's one 
    # 
    #location ~ /\.ht { 
    # deny all; 
    #} 
} 


# another virtual host using mix of IP-, name-, and port-based configuration 
# 
#server { 
# listen  8000; 
# listen  somename:8080; 
# server_name somename alias another.alias; 

# location/{ 
#  root html; 
#  index index.html index.htm; 
# } 
#} 


# HTTPS server 
# 
server { 
    listen  192.168.178.10:443 ssl; 
    server_name domain.net; 
#root /usr/share/nginx/html; 
    ssl_certificate /mnt/docker/nginx/certs/fullchain.pem; 
    ssl_certificate_key /mnt/docker/nginx/certs/privkey.pem; 

    #include /etc/nginx/conf/ssl_params; 

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
    ssl_prefer_server_ciphers on; 
    ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"; 
    ssl_session_cache shared:SSL:20m; 
    ssl_session_timeout 15m; 
    ssl_session_tickets off; 
    add_header X-Frame-Options SAMEORIGIN; 
    add_header X-Content-Type-Options nosniff; 
    add_header X-XSS-Protection "1; mode=block"; 

    #add_header Strict-Transport-Security "max-age=<HSTS_MAX_AGE>;<HSTS_SUBDOMAINS><HSTS_PRELOAD>"; 
    client_max_body_size 10G; 

    location /n/ { 
     alias /usr/share/nginx/html/; 
     index index.html index.htm; 
    } 

location /nextcloud/ { 
    access_log 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 https://192.168.178.11/; 
} 


    location ^~ /c{ 
    rewrite ^/c(.*) /$1 break; 
     proxy_pass https://192.168.178.11/; 
     proxy_connect_timeout 1; 
     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_set_header  X-Forwarded-Proto $https; 
    } 
    location/{ 
     root /usr/share/nginx/html; 
     index index.html index.htm; 
} 

} 
} 
+0

힘이 도움이 될 수> : https://github.com/evertramos/docker-compose-letsencrypt- https://github.com/evertramos/docker-nextcloud-letsencrypt와 함께 nginx-proxy-companion – Evis

답변

-1
upstream nextcloud { 
    server 127.0.0.1:8209 
} 

server { 

    listen 443 ssl; 

    server_name www.abc.xyz; 

    ssl_certificate server.crt; 
    ssl_certificate_key server.key; 
    ssl_client_certificate ca.crt; 


    add_header X-Content-Type-Options nosniff; 
    add_header X-XSS-Protection "1; mode=block"; 
    add_header X-Robots-Tag none; 
    add_header X-Download-Options noopen; 
    add_header X-Permitted-Cross-Domain-Policies none; 


    location = /robots.txt { 
     allow all; 
     log_not_found off; 
     access_log off; 
    } 


    rewrite ^/core/(.+?)$ /nextcloud/core/$1 last; 
    rewrite ^/apps/(.+?)$ /nextcloud/apps/$1 last; 
    rewrite ^/js/(.+?)$ /nextcloud/js/$1 last; 
    rewrite ^/css/(.+?)$ /nextcloud/css/$1 last; 
    rewrite ^/ocs/(.+?)$ /nextcloud/ocs/$1 last; 
    rewrite ^/settings/(.+?)$ /nextcloud/settings/$1 last; 
    rewrite ^/remote.php/(.+?)$ /nextcloud/remote.php/$1 last; 

    rewrite ^/login(.*)$ /nextcloud/login$1 last; 
    rewrite ^/lostpassword(.*)$ /nextcloud/lostpassword$1 last; 

    location /nextcloud { 
     proxy_set_header  Host $host; 
     proxy_set_header  X-Real-IP $remote_addr; 
     proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for; 
     proxy_set_header  X-Forwarded-Proto $scheme; 

     proxy_pass   http://nextcloud/; 
     proxy_read_timeout 90; 

     proxy_redirect  https://www.abc.xyz https://www.abc.xyz/nextcloud; 
    } 
} 

처럼 보인다?

gitlab-ce supply relative url 

https://docs.gitlab.com/omnibus/settings/nginx.html

external_url "https://gitlab.example.com"- "https://gitlab.example.com/git"나는이 설정 사용하고