🎨 Vue family bucket with socket.io and express/koa2 , create a web version of mobile QQ, supporting real-time group chat, real-time private chat, special care, shielding chat, smart IP geographic location, real-time display temperature and other QQ core functions
要想在程序中取得真实的IP,在执行nginx的configure时,必须指定参数“--with-http_realip_module”, 示例:
sudo ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
然后修改nginx配置文件:重启nginx: ./nginx -s reload 即可。 然后在express服务器里,通过 req.headers['x-real-ip']即可拿到真实ip地址