Home > Database > Redis > body text

How to configure redis to be accessible from the external network and only allow specified IPs to access redis

WJ
Release: 2020-06-08 17:30:46
Original
5020 people have browsed it

How to configure redis to be accessible from the external network and only allow specified IPs to access redis

# bind 192.168.1.100 10.0.0.1
# bind 192.168.1.8
# bind 127.0.0.1
Copy after login

After the modification is completed, the redis service needs to be restarted.

redis-server redis.conf如果iptables 没有开启6379端口,用这个方法开启端口
Copy after login

Command: /sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT Save firewall modification command: /etc/rc.d/init.d/iptables save

Allow specified external network IP access through iptables

Modify the Linux firewall (iptables) and open your redis service port. The default is 6379.

//只允许127.0.0.1访问6379iptables -A INPUT -s 127.0.0.1 -p tcp --dport 6379 -j ACCEPT//其他ip访问全部拒绝iptables -A INPUT -p TCP --dport 6379 -j REJECT
Copy after login

Before rejection is not configured

After rejection is configured

Another way is to enable it through bind mode

The above is to configure redis to be accessible from the external network. And only allow the specified IP to access all the contents of redis.

Related recommendations: Redis Tutorial

The above is the detailed content of How to configure redis to be accessible from the external network and only allow specified IPs to access redis. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:51dev.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!