AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-786543

haher's questions

Martin Hope
haher
Asked: 2021-10-28 13:17:24 +0800 CST

卷曲导致 500 清漆错误时,Apache 2.2 需要 401 授权

  • 0
[centos@staging03 ~]$ sudo netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 127.0.0.1:80                0.0.0.0:*                   LISTEN      3600/httpd          
tcp        0      0 127.0.0.2:80                0.0.0.0:*                   LISTEN      1574/varnishd       
tcp        0      0 172.31.22.60:80             0.0.0.0:*                   LISTEN      1539/nginx          
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1251/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1501/master         
tcp        0      0 127.0.0.1:443               0.0.0.0:*                   LISTEN      3600/httpd          
tcp        0      0 127.0.0.1:6082              0.0.0.0:*                   LISTEN      1573/varnishd       
tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      3468/php-fpm        
tcp        0      0 127.0.0.1:11211             0.0.0.0:*                   LISTEN      1229/memcached      
tcp        0      0 127.0.0.1:6379              0.0.0.0:*                   LISTEN      1061/redis-server 1 
tcp        0      0 :::22                       :::*                        LISTEN      1251/sshd           
tcp        0      0 :::3306                     :::*                        LISTEN      1383/mysqld 

我检查以调查我的服务器有什么问题,当我这样做时:

卷曲 127.0.0.1:80

我有:

401 需要授权

需要授权

此服务器无法验证您是否有权访问所请求的文档。要么您提供了错误的凭据(例如,错误的密码),要么您的浏览器不了解如何提供所需的凭据。


Apache/2.2.15 (CentOS) 服务器在 127.0.0.1 端口 80

在一切正常的另一台服务器上,我得到一个空白响应。所以我想这就是为什么我从 Apache 收到 500 varnish 错误的原因。

在 Apache 日志中,当我卷曲时我并没有真正得到任何东西,但在此之前我得到了:

[Wed Oct 27 17:02:25 2021] [notice] caught SIGTERM, shutting down
[Wed Oct 27 17:02:25 2021] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Oct 27 17:02:25 2021] [notice] Digest: generating secret for digest authentication ...
[Wed Oct 27 17:02:25 2021] [notice] Digest: done
[Wed Oct 27 17:02:25 2021] [notice] FastCGI: process manager initialized (pid 3602)
[Wed Oct 27 17:02:25 2021] [notice] Apache/2.2.15 (Unix) DAV/2 mod_fastcgi/2.4.6 configured -- resuming normal operations

所以看起来 FastCGI 配置正确,我从 Apache 得到的问题是一个身份验证问题,很奇怪。我还能做些什么来确定问题所在吗?

清漆提供以下内容:

   12 TxHeader     b X-Varnish: 1537309960
   12 RxProtocol   b HTTP/1.1
   12 RxStatus     b 500
   12 RxResponse   b Internal Server Error
   12 RxHeader     b Date: Wed, 27 Oct 2021 21:14:18 GMT
   12 RxHeader     b Server: Apache/2.2.15 (CentOS)
   12 RxHeader     b Expires: Wed, 11 Jan 1984 05:00:00 GMT
   12 RxHeader     b Cache-Control: no-cache, must-revalidate, max-age=0

但是,我无法检查 500 Internal Server Error 是什么,因为 php 的错误日志似乎是空的。

apache-2.2 varnish centos6
  • 1 个回答
  • 186 Views
Martin Hope
haher
Asked: 2021-10-27 13:22:00 +0800 CST

Apache 运行时出现“FetchError no backend connection”错误

  • 0
[centos@ip-172-35-25-65 ~]$  varnishlog
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1635280998 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1635281001 1.0
   10 SessionOpen  c 127.0.0.2 55870 127.0.0.2:80
   10 ReqStart     c 127.0.0.2 55870 894208400
   10 RxRequest    c GET
   10 RxURL        c /
   10 RxProtocol   c HTTP/1.0
   10 RxHeader     c X-Real-IP: 198.95.75.75
   10 RxHeader     c X-Forwarded-For: 198.95.75.75
   10 RxHeader     c X-Forwarded-Proto: https
   10 RxHeader     c X-Forwarded-Port: 80
   10 RxHeader     c Host: staging03.cherry.com
   10 RxHeader     c Connection: close
   10 RxHeader     c Cache-Control: max-age=0
   10 RxHeader     c Authorization: Basic aGc6am9objEyMw==
   10 RxHeader     c Upgrade-Insecure-Requests: 1
   10 RxHeader     c User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36
   10 RxHeader     c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
   10 RxHeader     c Accept-Encoding: gzip, deflate
   10 RxHeader     c Accept-Language: en-US,en;q=0.9,fr;q=0.8
   10 RxHeader     c Cookie: ajs_anonymous_id=%22424f4cd9-cbbc-4ead-83b1-273cb21cf453%22; _fbp=fb.1.1630002144579.2012566540; __qca=P0-1416512434-1630002144589; _edwvts=708154457303700204; _gid=GA1.2.1572498662.1635275261; ajs_user_id=%224543534%40mimpi99.com%22; _gcl_au=1.1.
   10 VCL_call     c recv pass
   10 VCL_call     c hash
   10 Hash         c /
   10 Hash         c staging03.cherry.com
   10 Hash         c 80
   10 Hash         c ajs_anonymous_id=%22424f4cd9-cbbc-4ead-83b1-273cb21cf453%22; _fbp=fb.1.1630002144579.2012566540; __qca=P0-1416512434-1630002144589; _edwvts=708154457303700204; _gid=GA1.2.1572498662.1635275261; ajs_user_id=%224543534%40mimpi99.com%22; _gcl_au=1.1.1880042
   10 VCL_return   c hash
   10 VCL_call     c pass pass
   10 FetchError   c no backend connection
   10 VCL_call     c error deliver
   10 VCL_call     c deliver deliver
   10 TxProtocol   c HTTP/1.1
   10 TxStatus     c 503
   10 TxResponse   c Service Unavailable
   10 TxHeader     c Server: Varnish
   10 TxHeader     c Content-Type: text/html; charset=utf-8
   10 TxHeader     c Retry-After: 5
   10 TxHeader     c Content-Length: 392
   10 TxHeader     c Accept-Ranges: bytes
   10 TxHeader     c Date: Tue, 26 Oct 2021 20:43:23 GMT
   10 TxHeader     c X-Varnish: 894208400
   10 TxHeader     c Via: 1.1 varnish
   10 TxHeader     c Connection: close
   10 TxHeader     c X-Age: 0
   10 TxHeader     c X-Cache: MISS
   10 Length       c 392
   10 ReqEnd       c 894208400 1635281003.852778196 1635281003.852984428 0.000073195 0.000165701 0.000040531
   10 SessionClose c error
   10 StatSess     c 127.0.0.2 55870 0 1 1 0 1 0 273 392
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1635281004 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1635281007 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1635281010 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1635281013 1.0

我试图记录从客户端获取时发生的事情:

Error 503 Service Unavailable
Service Unavailable

Guru Meditation:
XID: 894208400

现在,我认为这是因为 Apache 没有运行,因为当我关闭清漆时,我从 nginx 收到 502 网关错误。无论如何,我阅读了错误日志:

[Tue Oct 26 14:53:47 2021] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Tue Oct 26 14:53:47 2021] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Oct 26 14:53:47 2021] [notice] Digest: generating secret for digest authentication ...
[Tue Oct 26 14:53:47 2021] [notice] Digest: done
[Tue Oct 26 14:53:47 2021] [notice] FastCGI: process manager initialized (pid 23090)
[Tue Oct 26 14:53:47 2021] [notice] Apache/2.2.15 (Unix) DAV/2 mod_fastcgi/2.4.6 configured -- resuming normal operations
[Tue Oct 26 14:53:52 2021] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
[Tue Oct 26 14:53:52 2021] [error] [client 127.0.0.1] File does not exist: /var/www/html/favicon.ico, referer: http://staging03.hgreg.com/
[Tue Oct 26 15:01:21 2021] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
[Tue Oct 26 15:01:42 2021] [notice] caught SIGTERM, shutting down
[Tue Oct 26 15:01:42 2021] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Tue Oct 26 15:01:42 2021] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Oct 26 15:01:42 2021] [notice] Digest: generating secret for digest authentication ...
[Tue Oct 26 15:01:42 2021] [notice] Digest: done
[Tue Oct 26 15:01:42 2021] [notice] FastCGI: process manager initialized (pid 23299)
[Tue Oct 26 15:01:42 2021] [notice] Apache/2.2.15 (Unix) DAV/2 mod_fastcgi/2.4.6 configured -- resuming normal operations
[Tue Oct 26 15:11:56 2021] [notice] caught SIGTERM, shutting down

我看到 SIGTERM 正在关闭,所以我想也许我应该重新启动 Apache,我确实这样做了,但是我得到了同样的错误,并且 error_log 中没有新的日志。

[centos@ip-172-35-25-65 ~]$ sudo service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[centos@ip-172-35-25-65 ~]$ date
Tue Oct 26 17:12:32 EDT 2021
[centos@ip-172-35-25-65 ~]$ 

现在,我运行了一个 puppet 配置,但它并没有完全运行,但我有相同的文件。所以我想知道可能是什么问题。由于加载了所有带有 conf 的文件,因此加载的 Apache 配置文件之一是这样的:

<VirtualHost *>
    ServerName preprod.staging03.cherry.com

    
    
    ServerAlias betacherry.staging03.cherry.com staging03.cherry.com
    
    

    DocumentRoot /home/staging03/version/preprod.staging03.cherry.com
    ServerAdmin webmaster@cherry.ca

    SetEnv environment preprod
    SetEnv project staging03

    UseCanonicalName Off
    #CustomLog /var/log/httpd/preprod.staging03.cherry.com_log combined
    #CustomLog /var/log/httpd/preprod.staging03.cherry.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."

    ## User cherry # Needed for Cpanel::ApacheConf
    UserDir disabled
    UserDir enabled staging03
    
      #<IfModule mod_suphp.c>
    #    suPHP_UserGroup staging03 staging03
    #</IfModule>
    
    SuexecUserGroup staging03 staging03
    
    <directory "/home/staging03/version">
        AddHandler php5-fcgi .php
        Action php5-fcgi /php5-fcgi-staging03
        AllowOverride All

        
        AuthType Basic
        AuthName "staging03-preprod"
        AuthUserFile "/etc/httpd/conf.d/htpasswd.staging03"
        require valid-user

        satisfy any
        deny from all

        Order deny,allow
        SetEnvIf X-Hg-Internal-IP 1 HgInternalIP=1
        Allow from env=HgInternalIP

        SetEnvIf User-Agent "Amazon CloudFront" AmazonCloudFront
        Allow from env=AmazonCloudFront

        SetEnvIf User-Agent "^(.*)Lighthouse(.*)$" Lighthouse=1
        Allow from env=Lighthouse
        
    </directory>
    <IfModule concurrent_php.c>
        php5_admin_value open_basedir "/home/staging03:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule !concurrent_php.c>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "/home/staging03:/usr/lib/php:/usr/local/lib/php:/tmp"
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "/home/staging03:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        <IfModule !mod_ruid2.c>
            SuexecUserGroup staging03 staging03
        </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
        RMode config
        RUidGid staging03 staging03
    </IfModule>
    <IfModule itk.c>
        # For more information on MPM ITK, please read:
        #   http://mpm-itk.sesse.net/
        AssignUserID staging03 staging03
    </IfModule>
</VirtualHost>

那么我应该查看哪些文件以及如何检查问题不是 Apache,因为我们有 nginx 路由到清漆,然后路由到 Apache,所以我认为 Apache 是问题所在,但我没有得到任何有用的信息从日志和 Apache 运行没有任何问题,它只是没有为页面提供服务,并且 Varnish 出于某种原因无法访问 Apache?

我正在运行 CENTOS 6,并且我有另一台具有相同配置且运行良好的服务器,但是当我比较 etc 文件夹时,我并没有真正看到任何显着差异。

centos apache-2.2 nginx varnish
  • 1 个回答
  • 67 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve