Gui*_*ssé 3 tomcat fedora nexus port80
我有一个fedora服务器.我通过yum包管理器安装了tomcat.然后我在webapps文件夹上部署了nexus war.我尝试使用jsvc在端口80上运行服务器并且无法正常工作.我看到你也可以使用port fowarding.什么是最好的选择?
我跟着3.8.从sonatype doc 运行代理服务器后面的Nexus,我有点困惑.我安装了httpd,我有以下配置,其中example.com是我的域名.
/etc/httpd/conf.d/nexus.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /nexus/ http://localhost:8081/nexus/
ProxyPassReverse /nexus/ http://localhost:8081/nexus/
ProxyPreserveHost On
<Location />
Order allow,deny
Allow from all
</Location>
ErrorLog logs/nexus/error.log
CustomLog logs/nexus/access.log common
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
/家庭/纪尧姆/ WWW /关系/ conf目录
# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus
# Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF
pr.encryptor.publicKeyPath=/apr/public-key.txt
Run Code Online (Sandbox Code Playgroud)
当我试图访问
http://localhost:8081/nexus/index.html 一切正常http://localhost/nexus/index.html 一切正常http://example.com/nexus/index.html 只是挂起(端口80在防火墙中打开)
$ netstat -tulpn | grep:80
tcp 0 0 ::: 80 :::*LISTEN 3965/httpd
tcp 0 0 ::: 8081 :::*LISTEN 3811/java
udp 0 0 0.0.0.0:803 0.0.0.0:*1051/rpc.statd
关于如何使代理工作的任何线索?
我发现错误,dns错了:nslookup example.com解决了x.x.x.x我的ip时x.x.x.y
但我确实喜欢ngix配置
server {
listen 80;
server_name example.com;
access_log off;
error_log off;
location / {
proxy_pass http://localhost:8081;
proxy_redirect off;
#Proxy Settings
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# would be a good idea to redirect static assets
}
Run Code Online (Sandbox Code Playgroud)
可以使用authbind来完成工作(根本没有任何代理).使用它来连接它有点棘手,因为nexus是由一个java服务包装器(jsw)启动的,而后者又是由一个启动脚本启动的(如果需要的话,它会将自己召唤为另一个用户).
解决方案如下(相对路径相对于nexus主目录,$NEXUS_HOME):
conf/nexus.properties集合中application-port=80 application-host=0.0.0.0
(或任何你需要的)
为nexus创建一个(系统)用户,它有一个登录shell(!),例如
adduser --system --shell /bin/sh --no-create-home --group nexus(使所有nexus文件都属于新用户,例如
chown -R nexus:nexus .)bin/nexus调用su - $RUN_AS_USER ...,这就是用户nexus必须能够"登录"(不是真的)的原因.获取新用户的用户ID :( id -u nexus让我们假装它是108)
创建authbind配置文件/etc/authbind/byuid/108(使用nexus用户的id作为文件名):
0.0.0.0,80 ::,80
IP和端口应与使用的相同nexus.properties(参见步骤1).可能需要也可能不需要IPv6端口,具体取决于其他配置(来自Jetty).在authbind中启用它是安全的.
/usr/local/bin/authbind-java):#!/bin/sh exec authbind java "$@"
(使文件可执行,由chmod +x /usr/local/bin/authbind-java)
bin/jsw/conf/wrapper.conf,找到设置wrapper.java.command(应该读java作值)并将值替换为authbind-java(刚刚编写的帮助脚本).现在你准备开始nexus了.来自nexus的主页目录:
RUN_AS_USER=nexus bin/nexus start
(或直接编辑bin/nexus和设置RUN_AS_USER=nexus并致电bin/nexus start)
Nexus(jetty服务器)现在应该启动,初始化并最终绑定到端口80,但仍然作为"非特权"用户运行nexus.
旁注:由于您正在为端口80绑定nexus,它可能在自己的(虚拟)主机上运行,因此很容易为其指定一个自己的域名(例如nexus.example.com).这样做时,我更喜欢/nexus从URI中剥离前缀(上下文路径),以保存输入,它已经在域名中.要让nexus在根目录下服务,请设置nexus-webapp-context-path为/(in conf/nexus.properties).例如,存储库路径将成为http://nexus.example.com/content/repositories/releases(而不是http://nexus.example.com/nexus/content/repositories/releases).