Http Wget和Nginx可以';无法获取本地主机的内容

Http Wget和Nginx可以';无法获取本地主机的内容,http,curl,nginx,proxy,wget,Http,Curl,Nginx,Proxy,Wget,我可以在浏览器上打开我的Jenkins,但wget无法打开 wget http://localhost:8080 --2018-06-12 07:39:56-- http://localhost:8080/ Resolving localhost (localhost)... ::1, 127.0.0.1 Connecting to localhost (localhost)|::1|:8080... connected. HTTP request sent, awaiting respons

我可以在浏览器上打开我的Jenkins,但wget无法打开

wget http://localhost:8080
--2018-06-12 07:39:56--  http://localhost:8080/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:8080... connected.
HTTP request sent, awaiting response... 403 Forbidden
2018-06-12 07:39:56 ERROR 403: Forbidden.
curl可以做到这一点:

curl http://localhost:8080
<html><head><meta http-equiv='refresh' content='1;url=/login?from=%2F'/><script>window.location.replace('/login?from=%2F');</script></head><body style='background-color:white; color:white;'>


Authentication required
<!--
You are authenticated as: anonymous
Groups that you are in:

Permission you need to have (but didn't): hudson.model.Hudson.Read
 ... which is implied by: hudson.security.Permission.GenericRead
 ... which is implied by: hudson.model.Hudson.Administer
-->

</body></html>

您正在点击的页面似乎正在重定向到其他页面。 请在注释掉代理重定向并重新加载nginx后进行检查

#proxy_redirect  off

您正在点击的页面似乎正在重定向到其他页面。 请在注释掉代理重定向并重新加载nginx后进行检查

#proxy_redirect  off

发现了问题,我的Nginx配置文件完全正确,Jenkins服务器工作正常,但这是因为SELinux使得Nginx无法将请求传递给Jenkins

如何禁用SELinux

  • sudo nano/etc/selinux/config
  • 将行“SELINUX=”设置为:“SELINUX=disabled”
  • sudo重启

发现了问题,我的Nginx配置文件完全正确,Jenkins服务器工作正常,但这是因为SELinux使Nginx无法将请求传递给Jenkins

如何禁用SELinux

  • sudo nano/etc/selinux/config
  • 将行“SELINUX=”设置为:“SELINUX=disabled”
  • sudo重启

    • 具有完全相同的配置和错误,并对该问题进行了6个多小时的调查这对我来说是这样的:

      我需要检查Jenkins>管理Jenkins>配置全局安全性>授权>允许匿名读取访问


      更新:我刚刚意识到,整个Jenkins软件将开放给公众阅读。不理想。我需要找到一个合适的解决方案。

      具有完全相同的配置和错误,并对该问题进行了6个多小时的调查这对我来说是个问题:

      我需要检查Jenkins>管理Jenkins>配置全局安全性>授权>允许匿名读取访问

      更新:我刚刚意识到,整个Jenkins软件将开放给公众阅读。不理想。我需要找到一个合适的解决办法