我想通過HTTPS設置SCM-Manager。我在Debian上進行了安裝。我通過本地IP和HTTP使用SCM-Manager。 Nginx是代理並將請求轉換爲HTTPS。SVN + Nginx + HTTPS的SCM-Manager
proxy_pass http://127.0.0.1:8080;
proxy_redirect http://127.0.0.1:8080 https://repo.mydomain.org;
proxy_set_header X-Forwarded-Proto https;
include /etc/nginx/proxy.conf;
這裏是SCM的配置:
<base-url>https://repo.mydomain.org/</base-url>
server-config.xml => <Set name="contextPath">/scm</Set>
=> <Set name="forwarded">true</Set>
=> <SystemProperty name="jetty.host" default="127.0.0.1" />
一切工作正常,但我有一個錯誤,當我想看到一個diff或文件。在HTTP上獲取內容的URL,而不是HTTPS。下面是從不同的瀏覽器(Firefox,鉻,IE)的輸出:
從鉻:
混合內容:在 'https://repo.mydomain.org/#contentPanel;BQPsols4p3;null;trunk/init.php;content' 頁面用HTTPS加載,但要求一個不安全的XMLHttpRequest 端點 'http://repo.mydomain.org/api/rest/repositories/BQPsols4p3/content/?path=trunk/init.php&_dc=1470349149784'。 此請求已被阻止;內容必須通過HTTPS提供。
爲什麼系統試圖通過HTTP而不是HTTPS獲取數據?
另一個小錯誤是軟件試圖獲得這種語言腳本,但它們不存在於服務器上。
/resources/moment/lang/fr.js
/resources/extjs/i18n/ext-lang-fr.js
/resources/js/i18n/fr.js
/resources/moment/lang/fr.js
/resources/extjs/i18n/ext-lang-fr.js
/resources/js/i18n/fr.js
如何移除論文404?
編輯
這裏是Nginx的完整的配置:
user www-data;
#worker_processes auto;
worker_processes 4;
worker_rlimit_nofile 20480;
pid /run/nginx.pid;
events {
worker_connections 8192;
use epoll;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile off;
tcp_nopush off;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
client_body_timeout 60s;
client_header_timeout 60s;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_comp_level 1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
ssl off;
upstream scm {
server 127.0.0.1:8080;
}
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# Virtual Host Configs
##
server {
listen 80 default;
server_name _;
#access_log /var/log/nginx/host.access.log main;
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov|swf|dcr)$ {
root /home/www/public_html;
access_log off;
expires 30d;
}
location/{
root /home/www/public_html;
}
location ~ /\.ht {
deny all;
}
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
include /etc/nginx/sites-enabled/*;
}
網站啓用(最新的配置測試):
server {
listen 80;
server_name repv.mydomain.org;
location/{
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name repv.mydomain.org;
#access_log /var/log/nginx/host.access.log main;
error_log /var/log/nginx/error.log;
ssl on;
ssl_certificate /home/ssl/letsencrypt/live/repv.mydomain.org/fullchain.pem;
ssl_certificate_key /home/ssl/letsencrypt/live/repv.mydomain.org/privkey.pem;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /home/ssl/letsencrypt/live/repv.mydomain.org/fullchain.pem;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
ssl_dhparam /home/ssl/private/dhparams.pem;
location/{
rewrite ^([^.]*[^/])$ http://$host$1/ permanent;
proxy_pass http://scm;
include /etc/nginx/proxy.conf;
proxy_redirect http://scm https://repv.mydomain.org;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Ctx "";
}
}
而且proxy.conf:
proxy_redirect off;
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_hide_header X-Powered-By;
client_max_body_size 20m;
client_body_buffer_size 1024k;
send_timeout 90;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 16k;
proxy_buffers 8 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_buffering on;
proxy_http_version 1.1;
編輯2
我試圖切換到HTTP。但我有同樣的問題。當我想要查看文件或差異時,我收到消息「無法找到資源」。原因是被調用的ajax資源在沒有內容的情況下返回404錯誤。
示例:「http://repo.mydomain.org/api/rest/repositories/BQPsols4p3/content/?path=trunk/init.php&revision=30&_dc=1472061397498」返回404 ...;原始視圖「http://repo.mydomain.org/api/rest/repositories/BQPsols4p3/content/?path=trunk/init.php&revision=30」返回一個404.
你能幫我找到問題嗎?
感謝你的幫助,
斯特凡
這很奇怪,因爲scm-manager對每個請求都使用相對URL。你可以發佈/etc/nginx/proxy.conf文件嗎? – sdorra
I18n文件是基於瀏覽器的主要語言環境加載的。如果主語言環境不是英語,scm-manager會嘗試爲您的主語言查找語言環境文件,並使用i18n文件中的標識覆蓋ui標籤。如果找不到文件(404錯誤),scm-manager會回退到英文。 – sdorra
我編輯了答案,請找到配置文件。好的404,但我覺得這個方法不是很乾淨。最好使用帶有可用語言的字典,並嘗試使用默認語言顯示瀏覽器語言(如果不存在)。謝謝。 – Acti67