This article describes how to obtain the geographic location of Node. js and PHP Based on the ip address. You can use the Sina interface to obtain the City Based on the ip address. For more information, see Node. js implementation code.
The Code is as follows:
Var http = require ('http ');Var util = require ('til ');
typically does not have such a server architecture.Questions such as my topic, I use this server external IP address, occasionally appear 2s reason is what?There is only one case of accidents, there are countless cases of accidents.
This is not about the Internet.
Direct to the MLM, people earn you 2s profit, not a ruthlessNiu, can explain specifically, in the same server connected to the MySQL database,
One server is bound to multiple domain names, and the Web server has only one public IP address. However, many websites with independent domain names run on the server, and multiple independent domain names direct to this public IP address, however, you can access the website content corresponding to your domain name.
/ifcfg-enp0s3
We will edit four parts in the file. Pay attention to the following four places and never touch anything else. Double quotation marks are also retained to input your data among them.IPADDR = "[enter your static IP address here]"GATEWAY = "[enter your default GATEWAY]"DNS1 = "[your DNS 1]"DNS2 = "[your DNS 2]"
After 'ifcfg-enp0s3' is changed, it looks like the image below. Note that your
Vsftpd:118.126.3.222:allow
Indicates that a 118.126.3.222VSFTP connection is allowed
Input Vim/etc/hosts.deny
Edit Vsftpd:all
Indicates that all VSFTP connections are denied
In general, Linux will first Judge/etc/hosts.allow this file, if the remote login computer to meet the file/etc/hosts.allow settings, it will not be used/etc/ Hosts.deny file, on the contrary, if you do not meet the rules of Hosts.allow file set, you will use the Hosts.deny file, if the Hosts.deny rules, this host is limit
["REMOTE_ADDR"];}Else {$ Cip = "cannot be obtained! ";}Return $ cip;}Echo GetIP ();?> Here I have a public method to obtain the user IP address: The code is as follows:Copy code Function get_user_ip (){If (isset ($ _ SERVER ['http _ CLIENT_IP ']) $ _ SERVER ['http _ CLIENT_IP']! = 'Unknown '){$ Ip = $ _ SERVER [&
In linux, you only need to modify the file to resolve the domain name to an IP address, and add the IP address of the domain name server of the ISP (network service provider) in your location to it, if you do not know the IP
Borrow Sina IP Address library to fetch the user's city and region PHP version
/* $ip =real_ip ();$url = ' http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=jsip= '. $ip;$content =fopen_url ($url);$EXP = '/country ': "(. *?)", "Province": "(. *)", "City": "(. *)", "District": "", "
Tencent IP Address query interface: http://fw.qq.com/ipaddress
Sina IP Address query interface: HTTP://INT.DPOOL.SINA.COM.CN/IPLOOKUP/IPLOOKUP.PHP?FORMAT=JS
Sohu IP Address query interface: Http://pv.sohu.com/cityjson
Google
How to use: Ipsearch.getaddresswithip ("202.96.128.167")
CS Class Code
Copy Code code as follows:
Using System;
Using System.Data;
Using System.Configuration;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;
Introduction of namespaces
Using System.IO;
Judge IP attribution to class
public class Ipsear
format. For convenience, the returned format uses JSON, or Format=json, so that PHP extends the curl outside, and also extends JSON:
* * Based on Sina IP query interface to obtain IP location
/function Getiploc_sina ($queryIP) {
$url = ' http://int.dpool.sina.com.cn/ Iplookup/iplookup.php?format=jsonip= '. $queryIP;
$ch = Curl_init ($url);
curl_setopt ($ch, curlopt_encoding, ' UTF8 ');
Tencent IP address query interface: http://fw.qq.com/ipaddressSina IP address query interface: http://int.dpool.sina.com.cn/iplookup/iplookup.php? Format = jsSohu IP address query interface: http://pv.sohu.com/cityjsonGoogle
withServerNameThe command matchesSegment servo.Note:
If you want to, you can replace it with a fixed IP address"*". In this case,VirtualHostParametersRequiredAndNameVirtualHostParameters are consistent:
NameVirtualHost 172.20.30.40
# Others...
However, when your IP address cannot be determined, use"*"It is very conven
Here are a few ways to recommend people
Method one: In Baidu search "IP" will be directly out of the computer network IP address.
Method Two: Open the Start menu, enter "cmd" in the Search box-enter "ipconfig" in the black box that pops up to see your IP address.
Meth
Can the IP address and computer name of the DC be changed arbitrarily? The answer is certainly not. Here's how to change the IP and computer name of a DC.One. Change the domain controller IP address. (Don't forget to change the DNS server in DHCP after you've finished changi
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.