Geo IP¶
Ghi chú
Tài liệu này chỉ áp dụng cho cơ sở dữ liệu On-premise.
Cài đặt¶
Download both the GeoLite2 City and Country databases. You should end up with two files called
GeoLite2-City.mmdb
andGeoLite2-Country.mmdb
.Move the files to the folder
/usr/share/GeoIP/
.mv ~/Downloads/GeoLite2-City.mmdb /usr/share/GeoIP/ mv ~/Downloads/GeoLite2-Country.mmdb /usr/share/GeoIP/
Khởi động lại máy chủ
Ghi chú
If you don’t want to locate the geoip database in /usr/share/GeoIP/
, use the
--geoip-city-db
and
--geoip-country-db
options of the Odoo command line
interface. These options take the absolute path to the GeoIP database file and use it as the
GeoIP database. For example:
./odoo-bin --geoip-city-db= ~/Downloads/GeoLite2-City.mmdb
Xem thêm
Kiểm tra vị trí địa lý GeoIP trong trang web Odoo của bạn¶
Chỉnh sửa trang web để bao gồm một số thông tin geo-ip như tên quốc gia của địa chỉ IP yêu cầu hiện tại. Các bước thực hiện như sau:
Go to your website. Open the web page that you want to test
GeoIP
.Choose
.Thêm đoạn XML sau vào trang:
<h1 class="text-center" t-esc="request.geoip.country.name or 'geoip failure'"/>
Lưu và làm mới trang.
Geo-ip sẽ hoạt động nếu bạn thấy tên quốc gia của mình được hiển thị đậm ở giữa trang.
Nếu bạn thấy “lỗi geoip” thì lỗi định vị địa lý đã xảy ra. Các nguyên nhân phổ biến là:
The browsing IP address is the localhost (
127.0.0.1
) or a local area network one. If you don’t know, you can access your website using mobile data.You are using a reverse-proxy (apache, nginx) in front of Odoo but didn’t start Odoo with the proxy-mode enabled. See
proxy mode
.Cơ sở dữ liệu GeoIP bị hỏng, bị thiếu hoặc không thể truy cập được. Trong trường hợp đó, cảnh báo đã được ghi vào nhật ký máy chủ.