How to enable https (localhost) url in WAMP server (v2.5)? [duplicate]

六眼飞鱼酱① 提交于 2019-11-28 06:30:59
azdoud

You have to set up your WAMP first with key and a certificate:

  1. Download openssl choose the appropriate version according to your Operating system from here.
  2. Install it, than run the cmd and get where you've installed it: cd 'C:\OpenSSL-Win**' be sure be in the appropriate folder

  3. run these commands :

    • C:\OpenSSL-Win..\bin>openssl genrsa -aes256 -out private.key 2048
    • C:\OpenSSL-Win..\bin>openssl rsa -in private.key -out private.key
    • C:\OpenSSL-Win..\bin>openssl req -new -x509 -sha1 -key private.key -out certificate.crt -days 36500 -config C:\OpenSSL-Win..\bin\openssl.cfg

    You will be asked to enter a pass phrase for private.key, Country Name and so on.

  4. Once you are done, the files will be generated: private.key and certificate.crt, create a folder, name it key in this path C:\wamp...bin\apache\apache2.*.**\conf .

  5. Open this file httpd.conf. You'll find it in C:\wamp...bin\apache\apache2.*.**\conf uncomment these lines by removing # at the beginning of the line, than save the file.

    LoadModule ssl_module modules/mod_ssl.so
    LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
    Include conf/extra/httpd-ssl.conf
    
  6. Open httpd-ssl.conf file you'll find it also in C:\wamp...bin\apache\apache2.*.**\conf\extra and change the default value by these lines, pay attention to the path, I ve created a folder ssl inside C:/wamp../bin/apache/apache2.*.**/logs/

    <VirtualHost _default_:443>
    #   General setup for the virtual host
    DocumentRoot "C:/wamp../www"
    ServerName localhost:443
    ServerAdmin admin@example.com
    ErrorLog "C:/wamp../bin/apache/apache2.*.**/logs/ssl/error.log"
    TransferLog "C:/wamp../bin/apache/apache2.*.**/logs/ssl/access.log"
    ....
    CustomLog "C:/wamp../bin/apache/apache2.*.**/logs/ssl/ssl_request.log" \
    ....
    SSLCertificateFile "C:/wamp../bin/apache/apache2.*.**/conf/key/certificate.crt"
    SSLCertificateKeyFile "C:/wamp../bin/apache/apache2.*.**/conf/key/private.key"
    

    once done save your file.

  7. I copied ssleay32.dll & libeay32.dll from C:\wamp..\bin\php\php7.0.10 folder to c:\windows\system32.

  8. finaly check the configuration get in cd C:\wamp64\bin\apache\apache2.4.23\bin and run this command httpd -t if everything is okay you will get .

    C:\wamp64\bin\apache\apache2.4.23\bin>httpd -t
    Syntax OK
    
  9. https://localhost/ will work for you :)

By default, you can't use https protocol for your wamp connections. What you need to do is to set up a self-signed certificate on wamp.

Follow this tutorial for more information.

Edit: I've moved my answer to the original topic - How to enable SSL in WAMP Server?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!