我的nginx设置有点问题。我计划在一个网络中创建多个,其中一个中央服务器作为代理。
|---(/nextcloud/)--->Nextcloud-Server
-----> Central-Server--->|
|---(/git)---------->Git-Server
|
|---(/Redmine)---------->Redmine-Server
由于某种原因,我使用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 :(得分:-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;
}
}
仅针对下一个云,你选择哪个git服务器?
gitlab-ce supply relative url
https://docs.gitlab.com/omnibus/settings/nginx.html
external_url“https://gitlab.example.com” - &gt; “https://gitlab.example.com/git”