Last active
July 2, 2022 22:59
-
-
Save muthuishere/c1ed5a59f92809b1b3d7ae293e52102b to your computer and use it in GitHub Desktop.
Setup SSL on WAMP for virtual server Virtual hosts on wamp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set WAMP_INSTALL_LOCATION="c:\wamp" #modify | |
1. Open command prompt as admin Goto %WAMP_INSTALL_LOCATION%\bin\apache\apache2.x.x\bin> | |
2. Type => set OPENSSL_CONF=%WAMP_INSTALL_LOCATION%\bin\apache\apache2.x.x\conf\openssl.cnf | |
3. Create self signed certificate | |
Type => openssl req -nodes -new -x509 -keyout server.key -out server.crt | |
#Note if you get ordinal error , open ssl should be changed download it from http://slproweb.com/products/Win32OpenSSL.html based on 32 bit or 64 bit , select light version(Winxx OpenSSL v1.1.0b Light) and make sure to set libraries under install location rather than system32 folder | |
After installation copy openssl.exe & dlls from the installation folder and replace on %WAMP_INSTALL_LOCATION%\bin\apache\apache2.x.x\bin | |
Copy server.crt to folder %WAMP_INSTALL_LOCATION%\bin\apache\apache2.x.x\conf\cert\ | |
Copy server.key to folder %WAMP_INSTALL_LOCATION%\bin\apache\apache2.x.x\conf\key\ | |
4. Edit %WAMP_INSTALL_LOCATION%\bin\apache\apachex.x.x\conf\httpd.conf | |
Uncomment (remove #) => Ssl_module LoadModule modules / mod_ssl .so | |
uncomment (remove #) => LoadModule socache_shmcb_module modules/mod_socache_shmcb.so | |
Uncomment (remove #) => Include conf/extra/httpd-ssl conf | |
5. Edit %WAMP_INSTALL_LOCATION%\bin\php\php5.x.x\php.ini | |
Uncomment(remove semicolon) => extension = php_openssl.dll | |
Edit %WAMP_INSTALL_LOCATION%\bin\apache\apache2.x.x\conf\extra\httpd-ssl.conf | |
Find the line: <VirtualHost _default_: 443> and comment whole mark and use the below syntax | |
<VirtualHost _default_:443> | |
DocumentRoot "{YOUR_VIRTUAL_HOST_FOLDER}" | |
ServerName virtual.local:443 | |
ServerAdmin [email protected] | |
ErrorLog "%WAMP_INSTALL_LOCATION%/logs/sslerror.log" | |
TransferLog "%WAMP_INSTALL_LOCATION%/logs/sslaccess.log" | |
<Directory "{YOUR_VIRTUAL_HOST_FOLDER}"> | |
AllowOverride All | |
Require local | |
</Directory> | |
SSLEngine on | |
SSLCertificateFile "%WAMP_INSTALL_LOCATION%/bin/apache/apache2.x.x/conf/cert/server.crt" | |
SSLCertificateKeyFile "%WAMP_INSTALL_LOCATION%/bin/apache/apache2.x.x/conf/key/server.key" | |
<FilesMatch "\.(cgi|shtml|phtml|php)$"> | |
SSLOptions +StdEnvVars | |
</FilesMatch> | |
<Directory "%WAMP_INSTALL_LOCATION%/bin/apache/apache2.x.x/cgi-bin"> | |
SSLOptions +StdEnvVars | |
</Directory> | |
BrowserMatch "MSIE [2-5]" \ | |
nokeepalive ssl-unclean-shutdown \ | |
downgrade-1.0 force-response-1.0 | |
CustomLog "%WAMP_INSTALL_LOCATION%/logs/ssl_request.log" \ | |
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" | |
</VirtualHost> | |
# to just add vhost for wamp | |
Uncomment from apache conf | |
Include conf/extra/httpd-vhosts.conf | |
Add two entries in conf/extra/httpd-vhosts.conf , one for existing localhost and other for new vhost order is important | |
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
DocumentRoot "C:/wamp/www" | |
ServerName localhost | |
ServerAlias localhost | |
ErrorLog "logs/localhost-error.log" | |
CustomLog "logs/localhost-access.log" common | |
</VirtualHost> | |
<VirtualHost xxx.local:80> | |
ServerAdmin [email protected] | |
DocumentRoot "C:/muthu/gitworkspace/xxx/xxx-web" | |
<Directory "C:/muthu/gitworkspace/xxx/xxx-web"> | |
Options Indexes FollowSymLinks | |
AllowOverride All | |
Require local | |
<IfModule mod_php5.c> | |
php_admin_flag engine on | |
php_admin_flag safe_mode off | |
php_admin_value open_basedir none | |
</ifModule> | |
</Directory> | |
ServerName xxx.local | |
ServerAlias xxx.local | |
ErrorLog "logs/xxx-web-error.log" | |
CustomLog "logs/xxx-web-access.log" common | |
</VirtualHost> | |
#end for adding virtual hosts | |
Verify all syntax from commandline | |
httpd -t | |
Add the below entry for server xxx.local at end of the hosts file ( %WINDIR%\system32\drivers\etc\hosts) | |
127.0.0.1 xxx.local | |
ReStart WAMP | |
Restart DNS client from services.msc |
Open services.msc in windows, type in run
Check for service DNS client ,Right click and select restart
…On Thu, 18 Jun 2020, 15:53 Dendi Handian, ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
How to Restart DNS client from services.msc ?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/c1ed5a59f92809b1b3d7ae293e52102b#gistcomment-3346046>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABALVF4NALPJWJRE7LELKDRXHTJLANCNFSM4HXJNKTA>
.
After almost 4 years this thing is saving my sh*t <3
which folder is "{YOUR_VIRTUAL_HOST_FOLDER}" ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to
Restart DNS client from services.msc
?