Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 am trying to setup a local network and I am using these kind of types of network.

  1. Main server which connects to internet with static IP
  2. Second computer connected to first one locally with address like - when I write this address to address line it is like i wrote localhost in original main server - so it should show my local web browser etc ...

It has domain name this IP and connected router for it ... example so I added to my main server hosts file (linux powered) lines like these:

It was working ok when I entered my domain name in local computer it showed my site ... But after some time I added HTTPS cerfiticate and added this line to my apatche server:

Redirect permanent /

And now it does not work even when i add something like this to my hosts file:

So any idea how do do this thing work? Thank you.

share|improve this question

closed as off-topic by ceejayoz, Greg Askew, womble, MadHatter, Jenny D Sep 2 '15 at 14:16

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions should demonstrate reasonable business information technology management practices. Questions that relate to unsupported hardware or software platforms or unmaintained environments may not be suitable for Server Fault - see the help center." – ceejayoz, Greg Askew, MadHatter, Jenny D
If this question can be reworded to fit the rules in the help center, please edit the question.

2 hour penalty for "does not work". – Ignacio Vazquez-Abrams Jun 4 '12 at 0:52
You don't specify a protocol in a hosts file (or DNS A record) – MDMarra Jun 4 '12 at 0:53
@IgnacioVazquez-Abrams - I do not see any difference between "does not work" and for example "adding https broke my settings" etc it is metter of speech ... – Byakugan Jun 4 '12 at 1:00
@MDMarra When I do not specify it why is that redirecting causing trouble now? – Byakugan Jun 4 '12 at 1:00
If you can't tell the difference between "cause" and "effect" then.... I don't know what to tell you. – Ignacio Vazquez-Abrams Jun 4 '12 at 1:11
up vote 3 down vote accepted

Hosts files for dummies. DNS doesn't give a rip about protocols, it's only there to translate numbers to human readable names. (well mostly true) So revert your hosts file line back to:

The question is mostly incomplete as you don't explain why a redirect was necessary or if you properly set up your Apache server to accept SSL/TLS connections. I'd vote that the server hasn't been set up to accept port 443 traffic properly and the redirect is sending the traffic to an unresponsive or non-existent HTTPS port.

Since this is a question about a home network, the question will probably be closed as not appropriate to ServerFault.

If your redirect was supposed to change insecure connections to secure connections, the more appropriate way is to test the connection and switch it.

# Control access to php app, secure only

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

I'd recommend dumping the redirect for the nonce and work on getting the server to respond on both HTTP port 80 and HTTPS port 443 with the certificate properly installed. SSL/TLS Strong Encryption: FAQ

Only once you have this working would I recommend trying to direct all the traffic to HTTPS.

share|improve this answer
SSl is installed corectly - my point was to have always https on all web no metter what. – Byakugan Jun 4 '12 at 2:05
Do you have your hosts file cleaned up so it's not trying to force in an unwanted parameter that will keep the name from resolving to the IP address? So, when you remove the redirect, you can get in on HTTP and HTTPS? Correct? – Fiasco Labs Jun 4 '12 at 3:13
That is correct :) – Byakugan Jun 4 '12 at 10:42
Ok, if you put the redirect to HTTPS back in, does the site now fail? If so, check your web server error logs, there is probably a line giving you a specific message as to why the server cannot be contacted. You need to enable certain modules for things to work. Your original line, Redirect permanent / if letter perfect, requires to run. My version that checks to see how it was accessed (HTTP or HTTPS and then rewrite if HTTP) requires to be loaded. – Fiasco Labs Jun 4 '12 at 15:04
Actually I have it all working meaning that it is working as https with redirect BUT it is not working on localhost ... If I want to use in my local computers domain name instead of localhost that is my problem from the begining :) outside it is working perfectly but on localhost it is working only without https (redirect) – Byakugan Jun 4 '12 at 15:21

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