Set up a quick local web developer station trough HTTPS only

This article has been written before more than 24months, information might old.

From that start, I should be more precise, since otherwise, the title length will make most of the people be confused. So in fact, the story is like this, you usually have a bunch of VPSs or Linux machines but you like to have also a web server on your local machine that happens to run windows. And for that even though when you deploy a web app you might use another type of server, we all know that currently if you use a Windows based machine you better go with apache. Only that in some recent windows ports(around the time of the first php7 official releases) of apache either form ApacheLonge or Apache Haus, I got some problems with running them under HTTP protocol.( some request just were unresponsive)

Long story short, I said to myself why even listen on HTTP when I can use just HTTPS, and so I set a subdomain, in this case, dev.flashsoft.ro to point to my Pfsense home router then from my firewall I did a port forward on 8443 to point to my workstation then I set the proxy that responded to dev.flashsoft.ro:80 and dev.flashsoft.ro:443 to redirect on dev.flashsoft.ro:8443.

Why I use port 8443?, for three reasons first 8443 is a port allowed to pass CloudFlare proxy they have a short list of those allowed ports including this one, so from that list 8443 seemed like the most appealing.(After all is obvious that is just a 443 with 8 in front). Secondly, port 80 and 443 were proxied by Linux server and used for other means. And the third motive is that we involve after all just a web developer station so a custom port should be appropriate.

At this point, it is almost futile to stop HTTP listen from apache as it will not be accessible from outside the local network, but why not stop it, there is no reason why we shouldn’t do it so if you want to stop Apache from li we just get rid of Listen 80 line from our apache config.

For my HTTPS i set a VirtualHost directive as this:

<VirtualHost *:8443>
  SSLEngine on
  ServerName dev.flashsoft.ro:8443
  SSLCertificateFile "${SRVROOT}/conf/ssl/flashsoft.ro.cert.pem.crt"
  SSLCertificateKeyFile "${SRVROOT}/conf/ssl/flashsoft.ro.pkey.pem.key"
   DocumentRoot "E:/www/www"
	CustomLog "${SRVROOT}/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
	<Directory "${SRVROOT}/htdocs">
		Options Indexes Includes FollowSymLinks
		AllowOverride All
    Require all granted
	</Directory>
</virtualhost>

Also i set some custom http error pages just for the heck of it you can download those pages with the link bellow:

Also you can set them with this directives like(but i assume this is commun knowlege):

ErrorDocument 500 "/errors/500.html"
ErrorDocument 404 "/errors/404.html"
ErrorDocument 403 "/errors/403.html"
Share the joy

Leave a Reply