Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have apache server on a remote VPS. I have only port 80 and 443 open. I currently use port 443 for SSH and 80 for HTTP.

I want to make port 80 to use HTTPS not HTTP. All the solutions I saw was to redirect HTTP to HTTPS like this:

Redirect permanent / https://mywebsite.com/

but I don't think that this will work.

share|improve this question
1  
Do you have the ability to change your SSH port? For example, using 80 for SSH and 443 for HTTPS? –  Laurent Jan 26 '11 at 13:47
    
yes, no problem. I just want SSH and HTTPS. don't care about ports. –  Yousf Jan 26 '11 at 14:16

3 Answers 3

It won't work if you keep ssh on port 443, but if you move this to yet another port, it would work.

Of course you could configure Apache to use HTTPS on port 80, but this would mean that your users would have to explicitly specify the port to use, like https://www.example.com:80/yourfile.html because normally the browser would expect to talk http on port 80 and https on port 443. Also, users could run into problems with firewalls which make the same assumption and block https on port 80.

share|improve this answer

If you set HTTPS on port 80, this will break the majority of web browsers. HTTPS should be on 443. If anyone would go to "HTTPS://domain.com"; it would not work; likewise if they went to "HTTP://domain.com" it would not work either. Only if they went to "HTTPS://domain.com:80" would it work. Therefore, it could be by design choice that this configuration is rejected.

share|improve this answer

Change your SSH port to something else. Honestly, I keep mine at the default 22 - I find no reason to change this, even though lots of people recommend changing it. It does make it hard[er] to figure out the SSH port if you change it, but it's not impossible.

Additionally, you need to serve Apache on 80 (http) and Apache SSL on 443 (HTTPS). If you want to force redirection of HTTP -> HTTPS by setting up a redirect on the Apache side, however, if you aren't trying to force http->https, you just need to make sure that SSL is configured and enabled on Apache (no redirect required if you aren't forcing http -> https).

Default Ports:

22 -> SSH
80 -> HTTP
443 -> HTTPS

Recommendation:
Never set a service to use a well known port of another service.

share|improve this answer

Your Answer

 
discard

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.