如何在 vagrant 开发环境中使用 reCaptcha? [英] How do I use reCaptcha in a vagrant development environment?
问题描述
我正在使用 vagrant 进行开发.我想使用 reCapcha,当我在本地机器上开发时出现错误,该机器位于 vagrant 配置的专用网络 192.168.100.100 上的子域:
I am developing using vagrant. I'd like to use reCapcha how ever I get an error when when I'm developing on local machine which is at a subdomain on the vagrant configured private network 192.168.100.100:
ERROR for site owner:
Invalid domain for site key
recaptcha 在生产站点上运行良好.如何设置我的开发环境以使用 recaptcha?
The recaptcha works on the production site fine. How can I setup my development environment to work with recaptcha?
在 vagrant bootstrap 中有以下内容:
In the vagrant bootstrap are the following:
<Directory "/var/www/">
AllowOverride All
</Directory>
<VirtualHost *:80>
DocumentRoot /var/www/app
ServerName app.dev
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/phpmyadmin
ServerName phpmyadmin.dev
</VirtualHost>
我尝试将 locahost 和 192.168.100.100 添加到我的 recaptcha 密钥设置中,但这没有用.
I've tried adding locahost and 192.168.100.100 to my recaptcha key settings but this hasn't worked.
推荐答案
使用您的本地 vargrant IP 将您的域添加到 /etc/hosts
.然后在浏览器中访问您的域,它应该可以正常工作.
Add your domain to /etc/hosts
with your local vargrant IP. Then visit your domain in a browser and it should be working.
这篇关于如何在 vagrant 开发环境中使用 reCaptcha?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!