Установка Java
|
# apt-get update && apt-get install default-jdk |
|
# update-alternatives --config java |
|
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java Nothing to configure. |
|
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64" |
|
# source /etc/environment |
|
/usr/lib/jvm/java-8-openjdk-amd64 |
Установка Nexus
|
# wget http://download.sonatype.com/nexus/3/latest-unix.tar.gz |
|
# tar xvf latest-unix.tar.gz -C /opt/ |
|
# ln -s /opt/nexus-* /opt/nexus |
|
# useradd -m -r -s /bin/false nexus |
|
# chown -R nexus:nexus /opt/nexus-* /opt/sonatype-work /opt/nexus |
|
# nano /opt/nexus/bin/nexus.rc |
|
# nano /etc/systemd/system/nexus.service |
|
[Unit] Description=nexus service After=network.target [Service] Type=forking ExecStart=/opt/nexus/bin/nexus start ExecStop=/opt/nexus/bin/nexus stop User=nexus Restart=on-abort [Install] WantedBy=multi-user.target |
|
# systemctl daemon-reload && systemctl enable nexus |
|
# systemctl start nexus && systemctl status nexus |
Логи смотрим в
|
# tail -f /opt/sonatype-work/nexus3/log/*.log |
Настройка ротации логов Nexus
|
# cat /etc/logrotate.d/nexus |
|
/opt/sonatype-work/nexus3/log/*.log { daily dateext copytruncate missingok rotate 3 compress delaycompress notifempty } |
Установка Nginx
|
# wget -q -O - https://nginx.org/keys/nginx_signing.key | apt-key add - |
|
# nano /etc/apt/sources.list.d/nginx.list |
|
deb http://nginx.org/packages/ubuntu/ xenial nginx deb-src http://nginx.org/packages/ubuntu/ xenial nginx |
|
# apt-get update && apt-get install nginx |
|
# systemctl enable nginx && systemctl start nginx |
Настройка проксирования Nginx на Nexus
|
# nano /etc/nginx/conf.d/nexus.mydomain.com.conf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
upstream nexus_server { server 127.0.0.1:8081 fail_timeout=0; } server { listen 80; server_name nexus.mydomain.com www.nexus.mydomain.com; error_log /var/log/nginx/nexus-error.log; access_log /var/log/nginx/nexus-access.log main; location / { proxy_redirect off; proxy_pass http://nexus_server; 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_read_timeout 90; } } |
|
# nano /etc/nginx/ssl.conf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
ssl_session_cache shared:SSL:20m; ssl_session_timeout 1d; ssl_prefer_server_ciphers on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; ssl_dhparam /etc/nginx/ssl/dhparam.pem; # ssl_ecdh_curve secp521r1; ## Improves TTFB by using a smaller SSL buffer than the nginx default ssl_buffer_size 8k; ## Enables OCSP stapling ssl_stapling on; resolver 8.8.8.8; ssl_stapling_verify on; ## Send header to tell the browser to prefer https to http #add_header Strict-Transport-Security max-age=31536000; |
|
# openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
|
# nginx -t && service nginx reload |
Перевод Nexus […]