Larry Goldman

Q: Website Request Loop-back Routing?

Re: OS X Server 5.1

 

I am hosting multiple websites as shown by the following apachectl command:

 

bash-3.2# SERVER_INSTALL_PATH_PREFIX=/Applications/Server.app/Contents/ServerRoot apachectl -t -D DUMP_VHOSTS -f /Library/Server/Web/Config/apache2/httpd_server_app.conf
VirtualHost configuration:
127.0.0.1:34543        default (/Library/Server/Web/Config/apache2/sites/0000_127.0.0.1_34543_.conf:1)
127.0.0.1:34580        is a NameVirtualHost
         default server default (/Library/Server/Web/Config/apache2/sites/0000_127.0.0.1_34580_.conf:1)
         port 34580 namevhost default (/Library/Server/Web/Config/apache2/sites/0000_127.0.0.1_34580_.conf:1)
         port 34580 namevhost www.chapter12.com (/Library/Server/Web/Config/apache2/sites/0000_127.0.0.1_34580_www.chapter12.com.conf:1)

 

This indicates that the web server is listening on the local loop-back address of 127.0.0.1, with port 34580 corresponding to regular http traffic, and port 34543 corresponding to https traffic.

 

Meanwhile, lsof reports that httpd is also listening on ports 80 and 443 (several times), as expected:

 

bash-3.2# lsof -i -P | egrep 'httpd.*:(80|443) .*LISTEN'
httpd     77417            root    5u  IPv6 0xecb69e9b873eb8a9      0t0    TCP *:80 (LISTEN)
httpd     77417            root    7u  IPv6 0xecb69e9b815bc349      0t0    TCP *:443 (LISTEN)
httpd     80032            _www    5u  IPv6 0xecb69e9b873eb8a9      0t0    TCP *:80 (LISTEN)
httpd     80032            _www    7u  IPv6 0xecb69e9b815bc349      0t0    TCP *:443 (LISTEN)
httpd     80034            _www    5u  IPv6 0xecb69e9b873eb8a9      0t0    TCP *:80 (LISTEN)
httpd     80034            _www    7u  IPv6 0xecb69e9b815bc349      0t0    TCP *:443 (LISTEN)

 

In OS X Server 5, how is web traffic re-routed from the en0 address (10.0.1.240:80) to the lo0 address (127.0.0.1:34580)? In which configuration file is that specified?

OS X Server

Posted on Jun 29, 2016 1:53 PM

Close

Q: Website Request Loop-back Routing?

  • All replies
  • Helpful answers

  • by Larry Goldman,

    Larry Goldman Larry Goldman Jul 7, 2016 9:13 AM in response to Larry Goldman
    Level 1 (9 points)
    Servers Enterprise
    Jul 7, 2016 9:13 AM in response to Larry Goldman

    To answer my own question, see /Library/Server/Web/Config/apache2/readme.txt

     

    OS X Server (5.1) uses multiple instances of httpd.

     

    One instance is a "proxy" server, responsible for directing incoming requests to the appropriate service according to the URL of the request. This instance is launched from /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.a pple.serviceproxy.plist as follows:

     

    /usr/sbin/httpd -D FOREGROUND -f /Library/Server/Web/Config/Proxy/apache_serviceproxy.conf -E /private/var/log/apache2/service_proxy_error.log

     

    Another instance of httpd handles traffic for the Server's "Websites" service only. It is launched by launchd from /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.a pple.server.httpd.plist as follows:

     

    usr/sbin/httpd-wrapper -D FOREGROUND -f /Library/Server/Web/Config/apache2/httpd_server_app.conf -E /var/log/apache2/error_log