Sometimes, for a quick and very small project development we need a secure localhost connection.
As you might know, there is a built-in web server in PHP. The very simple command looks like:
# php -S 127.0.0.1:81
After running this command, the website will be available under the
But, what if we want to access this url via HTTPS protocol.
The one solution on Windows I found is next:
- Install it
- open configuration file
- At the end of the file put the next part of the code:
[https] accept = 82 connect = 81 cert = stunnel.pem
5. Save the configuration file and restart the program.
6. Run php built-in server:
php -S 127.0.0.1:81
7. Access the local website via:
https://127.0.0.1:82/ and accept the
NET::ERR_CERT_AUTHORITY_INVALID – the SSL connection warning.
If installed through the
brew, create configuration file located here:
P.S. Don’t forget that all this is for development purposes only!
2 thoughts on “How to prepare Local HTTPS Server via PHP built-in server using Stunnel on Windows”
This does not work in windows.
Actually, based on my experience I made this post and I’ve used this successfully.. only insecure connection warning might be annoying.. maybe I could help you?