Creating facebook application on localhost
As We know for Facebook Canvas we need server having ssl certificate installed.
We are going to install ssl on Xampp.
Open “C:\xampp\apache\conf\extra\httpd-vhosts.conf” file , append the following code and save it.Restart Xampp and you are done with ssl.Now you can access “https://localhost/myfbapp/”.If you want to avoid the security warning for this url,you can add this certificate to your browser(not necessary).
Note:-Replace “myfbapp” with the root directory of your project.And also change the path to Xampp if yours is different(i.e D:\).
NameVirtualHost *:80 NameVirtualHost *:443 <VirtualHost *:80> DocumentRoot "C:\xampp\htdocs" ServerName localhost </VirtualHost> <VirtualHost *:443> DocumentRoot "C:\xampp\htdocs\myfbapp" ServerName project_one.localhost SSLEngine on SSLCertificateFile "conf/ssl.crt/server.crt" SSLCertificateKeyFile "conf/ssl.key/server.key" <Directory "C:\xampp\htdocs\myfbapp"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot "C:\xampp\htdocs\myfbapp" ServerName project_two.localhost <Directory "C:\xampp\htdocs\myfbapp"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
- Now Go to your facebook app created on developers.facebook.com and put “https://localhost/myfbapp/” wherever needed.Save it.
- This Canvas Page URL will only work for your machine as we have done it using “localhost”.
Access your Canvas Page URL.You will see your app is working.
About The Author