Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to restrict access to a specific port only, on my apache server (I'd like that only the SSL port (443) is used on my webserver). So for example, if an user try to connect to standard port 80, he would get an access denied message. I googled for a possible solution, but I was not able to find good configuration examples.

If you need more information, don't hesitate to ask.

share|improve this question
up vote 2 down vote accepted

If you tell apache to simply not listen on port 80, then the user trying to get to your site will get an error message - but it will most likely make them think that your entire site is down.

Instead, I'd recommend that you set up a very simple configuration to accept incoming requests on port 80, but immediately issue a redirect to the SSL-enabled port 443. Like this:

<VirtualHost *:80>
    Redirect 301 /
share|improve this answer
Thanks a lot, I'll try this solution. I'll tell you if I was able to get it to works, thanks. – Luca D'Amico Apr 15 '14 at 9:14
If it works, just come back and accept the answer, it'll make it easier for anyone else who comes searching with the same question. Good luck! – Jenny D Apr 15 '14 at 9:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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