关于nginx:Linux-Nexus-安装

7次阅读

共计 2249 个字符,预计需要花费 6 分钟才能阅读完成。

NEXUS 介绍

nexus 是 java 开发中 maven 组件的公有库,对于团队开发是必不可少的撑持服务

NEXUS 装置

咱们先上 NEXUS 官网查找最新的 NEXUS 安装包。nexus-repository-oss 下载

[thinktik@host nexus3]$ wget https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.16.1-02-unix.tar.gz
[thinktik@host nexus3]$ tar -zxvf nexus-3.16.1-02-unix.tar.gz 
[thinktik@host nexus3]$ ls
nexus-3.16.1-02  nexus-3.16.1-02-unix.tar.gz  sonatype-work
# nexus 须要 java 环境,倡议 JDK1.8
[thinktik@host nexus3]$ java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
[thinktik@host nexus3]$  cd /home/thinktik/nexus3/nexus-3.16.1-02/bin
[thinktik@host bin]$ ls
contrib  nexus  nexus.rc  nexus.vmoptions
# 第一次启动,倡议这样看启动过程,及时发现问题
[thinktik@host bin]$ ./nexus run
# 没有问题的话,应用这个启动 nexus 服务,这样 nexus 会在后盾启动服务
[thinktik@host bin]$ ./nexus start

NEXUS 配置批改

nexus 升高内存占用

个别 nexus 默认的配置对机器的内存要求比拟高,对于集体开发者学习用的高价云服务器来讲是没有必要给这么多资源的,要么造成无谓的节约要么因为机器内存无限导致 nexus 无奈启动。我倡议个别集体开发和学习依照我这个配置来,尽量升高机器硬件要求。

-Xms100M
-Xmx330M
-XX:MaxDirectMemorySize=220M
-XX:+UnlockDiagnosticVMOptions
-XX:+UnsyncloadClass
-XX:+LogVMOutput
-XX:LogFile=../sonatype-work/nexus3/log/jvm.log
-XX:-OmitStackTraceInFastThrow
-Djava.net.preferIPv4Stack=true
-Dkaraf.home=.
-Dkaraf.base=.
-Dkaraf.etc=etc/karaf
-Djava.util.logging.config.file=etc/karaf/java.util.logging.properties
-Dkaraf.data=../sonatype-work/nexus3
-Djava.io.tmpdir=../sonatype-work/nexus3/tmp
-Dkaraf.startLocalConsole=false

NGINX 代理

neuxs 启动后默认监听的是计算机的 8081 端口,你能够应用 ip: 端口的形式间接拜访 neuxs。不过不倡议大家在服务器上裸露过多的端口,免得引起平安问题。应用 nginx 代理转发 neuxs 服务的形式会更平安也更不便一些。这里我应用域名转发的形式实现对 nexus 的服务代理。

  server { 
    listen 80; 
    server_name nexus.missioncenter.online;
    rewrite ^(.*)$  https://$host$1 permanent;
   }

    server {
     listen 443;
     server_name nexus.missioncenter.online;
     ssl on;
     root html;
     index index.html index.htm;
     ssl_certificate   /home/thinktik/env/nginx/cert/nexus_cert.pem;
     ssl_certificate_key  /home/thinktik/env/nginx/cert/nexus_cert.key;
     ssl_session_timeout 5m;
     ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
     ssl_prefer_server_ciphers on;
     location / {
         proxy_pass  http://127.0.0.1:8081;
         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_set_header X-Forwarded-Proto "https";
     }
    } 

本文原创链接: Linux Nexus 装置

正文完
 0