设为首页 收藏本站
查看: 1263|回复: 0

How to setup HTTPS [SSL] on WAMP

[复制链接]

尚未签到

发表于 2015-11-17 08:42:54 | 显示全部楼层 |阅读模式
How to setup HTTPS SSL on WAMP
  Recently I had to run a website with several https links under local server for testing and I had to configure the Open SSL server that comes with WAMP server. I'm sure it would be helpful for you as well.

  • First thing first, we need to create that self-signed SSL certificate, so go to DOS command prompt (Start menu -> Run -> cmd).
  • ext, we need to navigate to the directory that contains the openssl executive file which is located in folder C:\wamp\bin\apache\apache2.2.14\bin by default. In order to go there, we need to type the command as follows.
  Code:
  cd\wamp\bin\apache\apache2.2.14\bin

  • After press Enter, your prompt should change as follows
  Code:
  c:\wamp\bin\apache\apache2.2.14\bin>
  
From there, we begin to create the self-signed SSL certificate and the first command you have to type is as follows.
  Code:
  openssl genrsa -aes256 -out pass.key 2048

  • After press Enter and wait a little while, it should ask you for a pass phrase. Just type in anything but make sure you have to remember that for later use. Of course, it will ask you to verify the pass phrase.
    You may type test for testing.
  • Now, we will create the key for our server. In this tutor guide for HTTPS SSL on WAMP, we will use our domain test, but you should use your domain or design name instead.
  Code:
  openssl rsa -in pass.key -out test.key

  • Next, it will ask you to enter the pass phrase that you have created before. Wait a little while for it to write the key for your server.
  • Now is the time to type in the command to create our self-signed SSL certificate; since this command is quite long, you will see it takes more than one line, so make sure not to press the Enter key until you finish the whole command.
  Code:
  openssl req -new -x509 -nodes -sha1 -key test.key -out test.crt -days 999 -config C:\wamp\bin\apache\apache2.2.14\conf\openssl.cnf

  • After press Enter, it will ask you to input 2 letters that presents your country. You can enter LK, US, IN, JP, etc... that represents your country. Next you have to input your State or Province, City, Organization Name, Organization Unit Name, Common Nameand Email address.
  • Guess what, you just got yourself a self-signed SSL certificate. Now, open folderc:\wamp\bin\apache\apache2.2.14\conf and create a new folder "ssl" (without quotes).
  • Then, from folder c:\wamp\bin\apache\apache2.2.14\bin, copy 2 files key and crt to ssl folder. (test.key, test.crt)
  • Create another folder named as "logs" insidec:\wamp\bin\apache\apache2.2.14\conf\ssl. We save all HTTPS transaction and error logs in this folder.
  • After that, go to folder c:\wamp\bin\apache\apache2.2.14\conf\extra to open file httpd-ssl.conf.
  • Find this line:
  Code:
  SSLSessionCache "shmcb:C:/Program Files/Apache Software Foundation/Apache2.2/logs/ssl_scache(512000)"
Replace with:
  Code:
  SSLSessionCache "shmcb:C:/wamp/bin/Apache/apache2.2.14/conf/ssl/logs/ssl_scache(512000)"

  • Next find this line:
  Code:
  SSLCertificateFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/server.crt"
Remember to substitute expertcore with your domain to replace with:
  Code:
  SSLCertificateFile "C:/wamp/bin/Apache/apache2.2.14/conf/ssl/test.crt"

  • Then find:
  Code:
  SSLCertificateKeyFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/server.key"
Again, substitute expertcore with your domain to replace:
  Code:
  SSLCertificateKeyFile "C:/wamp/bin/Apache/apache2.2.14/conf/ssl/test.key"

  • Then find:
  Code:
  SSLMutex "file:C:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/logs/ssl_mutex"
Replace with:
  Code:
  SSLMutex default

  • In Virtual Host, find these lines:
  Code:
  # General setup for the virtual host
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
ServerName localhost:443
ServerAdmin admin@localhost
ErrorLog "C:/Program Files/Apache Software Foundation/Apache2.2/logs/error_log"
TransferLog "C:/Program Files/Apache Software Foundation/Apache2.2/logs/access_log"

HTTPS SSL is the secure transaction which is good for sensitive informations such as Credit card numbers, membership accounts... however, it might slow down your server performances if everything go through it; thus, we suggest that you only set it to the specificdirectory that you want to use for SSL, and in this example, we use folder ssl:
  Code:
  # General setup for the virtual host
DocumentRoot "C:/wamp/www/ssl"
ServerName test:443
ServerAdmin admin@localhost
ErrorLog "C:/wamp/bin/Apache/apache2.2.14/conf/ssl/logs/ssl_error.log"
TransferLog "C:/wamp/bin/Apache/apache2.2.14/conf/ssl/logs/ssl_access.log"

  • Then find:
  Code:
  <Directory &quot;C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin&quot;>
SSLOptions &#43;StdEnvVars
</Directory>
Modify to become as below:
  Code:
  <Directory &quot;C:/wamp/www/ssl&quot;>
SSLOptions &#43;StdEnvVars
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

  • Then find:
  Code:
  CustomLog &quot;C:/Program Files/Apache Software Foundation/Apache2.2/logs/ssl_request_log&quot; \&quot;%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \&quot;%r\&quot; %b&quot;
And change it as below:
  Code:
  CustomLog &quot;C:/wamp/logs/ssl_request.log&quot; \
&quot;%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \&quot;%r\&quot; %b&quot;

  • Next, open file httpd.conf in folder c:\wamp\bin\apache\apache2.2.14\conf and find these lines:
  Code:
  # Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf

Uncomment the second line, and make sure there is no blank space in front of second line and in the end of first line or your wamp will not run:
  Code:
  # Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf

  • After save and close all files, left click on WAMP tray icon and navigate to Apache modules and scroll down until you get ssl_module; then, left click on it to enable SSL on WAMP.
  • Next, navigate to PHP extensions and scroll down until you get php_openssl; then, left click on it to enable open_ssl on WAMP.
  • Left click on the WAMP tray icon and click on Restart all services.
  • After that, open folder C:\wamp\bin\apache\apache2.2.11\bin and copy 2 fileslibeay32.dll and ssleay32.dll and paste them in folder C:\Windows\System32.
  • Now is the time to test our HTTPS SSL on WAMP, so open your desire text editor and create a simple webpage index.html which is then saved in folderC:\wamp\www\ssl as follows:
  Code:
  <html>
<
body>
<font size=&quot;5&quot; color=&quot;red&quot;>test SSL successful</font>
</body>
</html>


  • Now is the time to run the created test file; open your desire browser and input the address bar as below, remember to replace test with your domain or design name:
  Code:
  https://test....

  • Oops, error... If using Firefox, you can left click on the line &quot;Or you can add an exception...&quot;. Again, left click on the button &quot;Add Exception&quot;.
  • On the popup windows, left click on the button &quot;Get Certificate&quot;.
  • You have to left click on the button &quot;Confirm Security Exception&quot;.
  • The moment of success that show up the red line in your browser.
    SSL successful
转截自:http://www.viduka.info/eblog/kebic/how-to-setup-https-ssl-on-wamp.html

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-140117-1-1.html 上篇帖子: Wamp2.5 64bit,无法修改MySQL datadir位置 下篇帖子: Wamp server配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表