管理Nexus Repository OSS

目录

支持域名访问

  Nexus默认使用8081端口,总是输入IP+端口,略麻烦。因此折腾一下,使用域名来访问Nexus。

修改Nexus配置

  Nexus默认Context Path/nexus。如果继续使用这个路径的话,使用域名访问会没办法登录。因此需要先修改Nexus的配置。

/opt/nexus/nexus-2.13.0-01/conf/nexus.properties

# nexus-webapp-context-path=/nexus
# 将context path修改为/
nexus-webapp-context-path=/

  重启nexus

$ ./nexus stop
Password: 
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Stopping Nexus OSS...
Stopped Nexus OSS.

$ ./nexus start
Password: 
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.

安装Nginx

  打开Terminal,安装Nginx。

$ sudo apt-get install nginx

  浏览器打开http://localhost,看看是否安装成功。

2016-07-17-setup-nginx

  修改Nginx配置文件,在最后面添加以下内容。

/etc/nginx/sites-available/default

server {
    listen 80;
    server_name nexus.postsync.cn; #修改成你的域名

    location / {
         proxy_pass  http://localhost: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; 
    }
}

  重新加载nginx。

$ sudo nginx -s reload

2016-07-17-setup-domain

Alan Yeh

简单技术控,喜欢接触各类技术

GZ, China http://yerl.cn