Even after modifying the file /Library/Server/web/config/apache2/httpd_server_app.conf to include Listen 127.0.0.1:80 line, I'm unable to have Apache on Mountain Lion Server listen to the localhost IP only. I need Apache to host only internal websites, while running nginx side by side to respond to external IP. Any idea?

Thanks in advance, Sammy

  • 1
    You can't have two processes listening to the same port. You have to pick one to listen, and then feed to the other one on an alternate port if necessary. – John Nov 27 '12 at 15:35
  • Well then how can I make apache listen to different ports? Apple seems to have completely locked it. I can't even delete their default website. – Sammy Nov 27 '12 at 21:08

You could easily have nginx running on port 80 which is responding to all requests. Once a connection from localhost has been made, you could route that request to a port running Apache.

In your server directive:

    if ($remote_addr = 127.0.0.1) {
        rewrite ^ <a href="https://$host:81$request_uri">https://$host:81$request_uri? permanent; 
    }

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.