Установка YouTrack на CentOS / Install YouTrack on CentOS
Установка Java:
# yum install java-1.8.0-openjdk-headless
Добавить пользователя:
# adduser youtrack
Скачать прогу:
# wget -O /home/youtrack/youtrack.jar https://download.jetbrains.com/charisma/youtrack-2021.3.24402.jar
Права на файл дать пользователю youtrack:
# chown youtrack:youtrack /home/youtrack/youtrack.jar
Создать файл /etc/systemd/system/youtrack.service и заполнить:
[Unit]
Description=Youtrack
Requires=network.target
After=syslog.target network.target
[Service]
Type=simple
WorkingDirectory=/home/youtrack
ExecStart=/usr/bin/java -jar /home/youtrack/youtrack.jar --J-Xmx1G 8080
ExecStop=/usr/bin/java -jar /home/youtrack/youtrack.jar stop
User=youtrack
[Install]
WantedBy=default.target
Установить права на запуск:
# chmod +x /etc/systemd/system/youtrack.service
Обновить сервисы, добавить в автозапуск и запустить:
# systemctl daemon-reload
# systemctl enable youtrack.service
# systemctl start youtrack.service
Открыть в браузере http://<your-host-name>:8080
Настройка NGINX
Пример настройки:
server {
listen 443 ssl http2;
ssl_certificate <path_to_certificate>;
ssl_certificate_key <path_to_key>;
server_name localhost;
add_header Strict-Transport-Security max-age=31536000;
location /contextPath/ {
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffers 8 64k;
proxy_busy_buffers_size 128k;
proxy_buffer_size 64k;
client_max_body_size 10m;
proxy_http_version 1.1;
proxy_pass http://youtrackmachine.domain.local:1111/contextPath;
}
location /contextPath/api/eventSourceBus {
proxy_cache off;
proxy_buffering off;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
proxy_set_header Connection '';
chunked_transfer_encoding off;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_pass http://youtrackmachine.domain.local:1111/contextPath;
}
}
Настройка Apache HTTP Server
В апач нужны модули: headers, rewrite, proxy_http, ssl, http2
Настройки для виртуального хоста (VirtualHost):
Protocols h2 http/1.1
RequestHeader set X-Forwarded-Proto "https"
RewriteEngine on
AllowEncodedSlashes on
ProxyRequests off
ProxyPass / http://127.0.0.1:1111/
ProxyPassReverse / http://127.0.0.1:1111/
SSLEngine On
SSLCertificateFile <path_to_certificate>
SSLCertificateKeyFile <path_to_key>
Дополнительный заголовок HSTS в директиву HTTPS VirtualHost
# Guarantee HTTPS for 1 Year including subdomains
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Редирект на VirtualHost HTTP для перенаправления на HTTPS
[...]
ServerName myYouTrackService.com
Redirect permanent / https://myYouTrackService.com/