The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Apache status not working after customizing port

Discussion in 'EasyApache' started by Karabaja, Jan 18, 2010.

  1. Karabaja

    Karabaja Active Member

    Joined:
    Mar 3, 2006
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    I've installed nginx last night to serve some static files and run along with apache.

    But now when I go to whm server status page and try to check apache status I get:

    Any ideas please if there is a way of getting it working again?
     
  2. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    817
    Likes Received:
    22
    Trophy Points:
    18
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    You can't use Apache status for nginx..nginx is not Apache.
     
  3. Karabaja

    Karabaja Active Member

    Joined:
    Mar 3, 2006
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    I realize that. As I wrote in my first post apache is running along nginx so I am trying to use apache status for apache, not for nginx. Apache port is changed to 81, nginx serves some static files and proxies everything else to apache.
     
  4. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    What method was used to customize the Apache listening port?

    Does the status show when checked via command-line (via root access on the same system)?
    Code:
    # lynx -dump http://127.0.0.1/whm-server-status
    # lynx -dump http://127.0.0.1:81/whm-server-status
     
    #4 cPanelDon, Jan 18, 2010
    Last edited: Jan 18, 2010
  5. Karabaja

    Karabaja Active Member

    Joined:
    Mar 3, 2006
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    I changed the port via tweak settings options in WHM then ran
    Code:
    /usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings
    As to commands you suggested the one to port 81 shows the status fine. The first one gets forbidden page.
     
  6. Karabaja

    Karabaja Active Member

    Joined:
    Mar 3, 2006
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    Sorry to bump this but I feel like I was gonna get the final answer from cPanelDon and the thread probably got to the second page and was lost from sight.

    Do I edit httpd.conf perhaps and change?
    Code:
    <Location /whm-server-status>
    to

    Code:
    <Location http://127.0.0.1:81/whm-server-status>
     
  7. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Thank you for the information; I was able to confirm the symptom while researching. For reference and tracking purposes, this issue has been assigned the following internal case ID number: #26350

    The described change should not be necessary, at least not in that file (not in "httpd.conf"). As a temporary fix or workaround, I would look at the following two files where the status URL is defined:
    Code:
    /etc/init.d/httpd
    /usr/local/apache/bin/apachectl
    As an example, here is what the stock-default entry is (as obtained via CLI output from "grep"):
    Code:
    # grep -i "^statusurl" /etc/init.d/httpd
    STATUSURL="http://localhost/whm-server-status"
    
    # grep -i "^statusurl" /usr/local/apache/bin/apachectl
    STATUSURL="http://localhost/whm-server-status"
    If needing to retain an edit to the above two files I recommend using one of the built-in hooks to execute a custom script or other custom commands that reapply the change or apply a patch. Here is our documentation regarding script hooks, for both cPanel/WHM and information specific to EasyApache:
    cPanel/WHM Script Hooks
    EasyApache Hook Scripts
    Here are a few examples that could be created and used as noted in the documentation:
    Code:
    /scripts/preupcp
    /scripts/postupcp
    /scripts/preeasyapache
    /scripts/posteasyapache
     
  8. Karabaja

    Karabaja Active Member

    Joined:
    Mar 3, 2006
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    Thx cPanelDon,
    I've tried applying the change to those files:
    Code:
    /etc/init.d/httpd
    /usr/local/apache/bin/apachectl
    But it still gets the same error in WHM when I attempt to view apache status.
     
  9. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    For the Apache status view in WHM I was unable to determine a desirable workaround; I believe a proper fix will depend on further inspection and examination per internal case ID #26350.

    Is the Apache status viewable via command-line, using one of the init scripts?
    Code:
    # /etc/init.d/httpd fullstatus
    # /usr/local/apache/bin/apachectl fullstatus
    When testing the Apache status via WHM and while nginx is running are there any messages logged in the Apache access_log and error_log?
    Code:
    /usr/local/apache/logs/access_log
    /usr/local/apache/logs/error_log
    Assuming the Apache logs are still at their usual paths, the following command could be used to monitor for new log entries while accessing the Apache status page in WHM:
    Code:
    # tail -fvn0 /usr/local/apache/logs/*log
     
  10. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Regarding the Apache logs I would like to know if nginx is at least relaying the request to Apache. If it is, it will help to know what IP address is being seen by Apache; the Location directive in the Apache configuration for the URI "/whm-server-status" by default only allows requests when accessed from localhost (IP: "127.0.0.1"):
    Code:
    <Location /whm-server-status>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
    </Location>
    If the request is not reaching Apache, I would consider adding a redirect in the custom nginx configuration.
     
  11. Karabaja

    Karabaja Active Member

    Joined:
    Mar 3, 2006
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    Both of these scripts give back apache status ok:
    Code:
    # /etc/init.d/httpd fullstatus
    # /usr/local/apache/bin/apachectl fullstatus
    Apache does still create error_log for the traffic that is relayed to it.
    But there was no record of me trying apache status from whm.

    There was a record in access_log. But I think it only appeared after I edited httpd.conf to include ip of the domain trough which I access the whm.

    This is what was in access_log:

    Code:
    127.0.0.1 - - [23/Jan/2010:19:46:24 +0100] "GET /whm-server-status HTTP/1.0" 200 15634
    127.0.0.1 - - [23/Jan/2010:19:46:49 +0100] "GET /whm-server-status HTTP/1.0" 200 15714
    Nginx isn't setup to use 127.0.0.1 as that creates issues with reporting of visitors ips. I've installed rpaf_module for apache. Maybe there is a problem with that somewhere as I couldn't really find enough documentation on how to do it so pretty much done trial and error until I got everything working fine and visitors ip correctly reported. Like in vbulletin's who's online list.

    Here is what I added in httpd.conf. I'll edit out ips and domains.

    Code:
    LoadModule rpaf_module modules/mod_rpaf-2.0.so
    RPAFenable On
    # Enable reverse proxy add forward
    RPAFproxy_ips 127.0.0.1 96.30.1x.xx 96.30.2x.xx 
    # which ips are forwarding requests to us
    RPAFsethostname On
    # let rpaf update vhost settings
    # allows to have the same hostnames as in the "real"
    # configuration for the forwarding Apache
    RPAFheader X-Real-IP
    Then in each virtual host section I've added:
    Code:
    <VirtualHost 96.30.1x.x:81>
    	RPAFenable On
    RPAFsethostname On
    RPAFproxy_ips 127.0.0.1 96.30.1x.x
        ServerName domain.com
    .......
    This is what part of the nginx vhost config looks like:

    Code:
     proxy_redirect  http://www.domain.com:81   http://www.domain.com;
       proxy_redirect  http://domain.com:81   http://domain.com;
     
       proxy_pass   http://96.30.1x.x:81/;
     
       proxy_set_header   Host   $host;
       proxy_set_header   X-Real-IP  $remote_addr;
       proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    I've tried adding another ip in httpd.conf like this:
    Code:
    <Location /whm-server-status>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1 96.30.1x.x
    </Location>
    But that still didn't help get status page from whm. Although it seem to have helped get some record in access_log of apache as mentioned at the top of the post.
     
    #11 Karabaja, Jan 23, 2010
    Last edited: Jan 23, 2010
  12. John_B

    John_B Registered

    Joined:
    May 27, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    same problem with Varnish

    I have the same problem after assigning Apache to port 8080, when installing caching reverse proxy Varnish on port 80.

    Varnish works great. However the whm-server-status request is passed through by Varnish to the Apache backend, and Apache returns a 403

    I run the --updatetweak.

    I have repeated the same with two installations at different hosting companies.

    BTW it is easy enough to have chkserv monitor Varnish, and Service Status works fine. But WHM's Apache Status link does not work.

    Details from the piped output of the varnishlog command follow (with my IP address replaced by xxx.xxx):

    13 SessionOpen c 127.0.0.1 45066 :80
    13 ReqStart c 127.0.0.1 45066 1282128770
    13 RxRequest c GET
    13 RxURL c /whm-server-status
    13 RxProtocol c HTTP/1.0
    13 VCL_call c recv
    13 VCL_return c lookup
    13 VCL_call c hash
    13 VCL_return c hash
    13 VCL_call c miss
    13 VCL_return c fetch
    14 BackendClose b default
    14 BackendOpen b default 213.175.xxx.xxx 44603 213.175.xxx.xxx 8080
    13 Backend c 14 default default
    14 TxRequest b GET
    14 TxURL b /whm-server-status
    14 TxProtocol b HTTP/1.1
    14 TxHeader b X-Forwarded-For: 127.0.0.1
    14 TxHeader b X-Varnish: 1282128770
    14 TxHeader b Host: 213.175.xxx.xxx
    14 RxProtocol b HTTP/1.1
    14 RxStatus b 403
    14 RxResponse b Forbidden
    14 RxHeader b Date: Thu, 27 May 2010 13:05:02 GMT
    14 RxHeader b Server: Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 mod_fcgid/2.3.5
    14 RxHeader b Accept-Ranges: bytes
    14 RxHeader b Transfer-Encoding: chunked
    14 RxHeader b Content-Type: text/html
    13 TTL c 1282128770 RFC 120 1274965502 0 0 0 0
    13 VCL_call c fetch
    13 VCL_return c pass
    13 ObjProtocol c HTTP/1.1
    13 ObjStatus c 403
    13 ObjResponse c Forbidden
    13 ObjHeader c Date: Thu, 27 May 2010 13:05:02 GMT
    13 ObjHeader c Server: Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 mod_fcgid/2.3.5
    13 ObjHeader c Content-Type: text/html
    14 BackendReuse b default
    13 Length c 2014
    13 VCL_call c deliver
    13 VCL_return c deliver
    13 TxProtocol c HTTP/1.1
    13 TxStatus c 403
    13 TxResponse c Forbidden
    13 TxHeader c Server: Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 mod_fcgid/2.3.5
    13 TxHeader c Content-Type: text/html
    13 TxHeader c Content-Length: 2014
    13 TxHeader c Date: Thu, 27 May 2010 13:05:02 GMT
    13 TxHeader c X-Varnish: 1282128770
    13 TxHeader c Age: 0
    13 TxHeader c Via: 1.1 varnish
    13 TxHeader c Connection: close
    13 ReqEnd c 1282128770 1274965502.816831827 1274965502.818354845 0.000334024 0.001486778 0.000036240
    13 SessionClose c not HTTP/1.1
    13 StatSess c 127.0.0.1 45066 0 1 1 0 0 1 283 2014
     
  13. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    The issue seen while using a customized Apache port, that was affecting the Apache Status page in WHM, is corrected in cPanel version 11.25.1 as of EDGE build number 45714; this newer version is presently only in EDGE (e.g., for development use and public testing). To determine when version 11.25.1 reaches other build trees such as CURRENT, RELEASE, and STABLE, please refer to the following resource on our web site: Latest cPanel/WHM Builds

    Here are the relevant change log details: (Reference: cPanel Change Log)
    Edge 45714 @ 2010-05-12 22:32:19
    • Update apachectl and httpd init script to use correct port for status as defined in Tweak Settings
    • Update WHM Apache status page to use correct port as defined in Tweak Settings
     
  14. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,474
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Important cPanel/WHM Version Number Designation Change

    Please Note: Important cPanel/WHM Version Number Designation Change

    As of July 28, 2010 the cPanel/WHM version number designations have been officially changed.

    Version 11.25.1 is now designated 11.28 and version 11.25.2 is now designated 11.30.

    These new changes were explained in some detail recently at the July 2010 - Quarterly Road map - Webinar direct from cPanel's PodCast Studio in Houston, Texas with speakers David Grega and Mario Rodriguez.

    An official press release about these changes is forthcoming and can be accessed at this link as soon as it's made available to the Forum Team:
    Important cPanel/WHM Version Number Designation Change (To be updated)

    This post serves to update users who are subscribed to threads (where this message is posted) looking forward to upcoming enhancements in future versions of cPanel.
     
  15. alexmack

    alexmack Member

    Joined:
    Jul 23, 2010
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    failed to retrieve apache status after port change

    we changed the apache port to 81 to have a reverse proxy with nginx but now the "apache status" page on whm won't load
     
  16. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
  17. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Friendly Moderator Note

    Two threads have been merged to combine related discussion about the same topic.
     
  18. ncl3us

    ncl3us Member

    Joined:
    Jun 11, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Hello;

    Any solution about apache status and also httpd status failed on whm?

    I have read here but no solution that can be found.

    Thx
     
  19. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    The Apache status issue, exhibited when Apache non-SSL (HTTP) port 80 is customized via Tweak Settings, is fixed in cPanel 11.28 (AKA 11.25.1) that is currently in the EDGE release tier.
     
  20. mediagenerator

    Joined:
    Mar 16, 2010
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Custom Apache port breaks apache munin plugin

    I believe this is somewhat related, since the Apache ports in the munin configuration file at /usr/share/munin/plugins/ seem to be hardcoded and do not seem to take custom settings into account which have been specified via Tweak Settings after installing Munin.

    I run Apache on 8081 and nginx on port 80. The port number specified apache_accesses is hardcoded to check for /whm-server-status on port 80.

    Reinstalling the Munin Plugin via "Manage Plugins" caused the Apache section to disappear completely from the service monitor.
     
Loading...

Share This Page