CURL ERROR 7 Failed to connect to Permission denied
来源:互联网 发布:绝地战争源码 编辑:程序博客网 时间:2024/05/19 22:02
“CURL ERROR 7 Failed to connect to Permission denied” error is caused, when for any reason curl request is blocked by some firewall or similar thing.
you will face this issue when ever the curl request is not with standard ports.
for example if you do curl to some URL which is on port 1234, you will face this issue where as URL with port 80 will give you results easily.
Most commonly this error has been seen on CentOS and any other OS with ‘SElinux’.
you need to either disable or change ‘SElinux’ to permissive
nano /etc/selinux/config
locate following line
SELINUX=enforcing
Change this to
SELINUX=disabled
reboot is needed
新安装完CentOS Linux,发现配置完apache后没法访问,估计是防火墙问题。
/etc/init.d/iptables status
会得到一系列信息,说明防火墙开着。
/etc/init.d/iptables stop
永久关闭:
chkconfig --level 35 iptables off
永久关闭SELinux
查看当前SELinux状态:
/usr/bin/setstatus -v
编辑/etc/selinux/config,找到SELINUX 行修改成为:SELINUX=disabled:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
重启系统。
Centos还提供了实时改变SELinux工作模式的工具,前提是SELinux没有被disabled掉的时候
/usr/sbin/setenforce 0 #使SELinux工作模式变成permissive模式
/usr/sbin/setenforce 1 #使SELinux工作模式变成enforcing模式
添加到系统默认启动脚本里面
echo "/usr/sbin/setenforce 0" >> /etc/rc.local
这样就可以实时控制SELinux的启用和不启用了。
三个参数介绍介绍
enforcing — The SELinux security policy is enforced.
permissive — The SELinux system prints warnings but does not enforce policy.
disabled — SELinux is fully disabled. SELinux hooks are disengaged from the kernel and the pseudo-file system is unregistered.
enforcing模式:强制组织。
permissive模式:SELinux系统输出警告,但是不强制阻止程序运行。
disabled模式:关闭模式
- CURL ERROR 7 Failed to connect to Permission denied
- CURL Failed to connect to Permission denied
- nginx error connect to php5-fpm.sock failed (13: Permission denied)
- [Docker] ERROR: Failed to creating docker image:Permission denied
- 解决Nginx的connect() to 127.0.0.1:8080 failed (13: Permission denied) while connect
- 解决Nginx的connect() to 127.0.0.1:8080 failed (13: Permission denied) while connect
- PHP failed to open stream: Permission denied
- failed to initialize KVM: Permission denied
- failed to open stream: Permission denied in
- Failed to pull selection: Permission denied
- connect() to unix:/dev/shm/php5629-fpm.socket failed (13: Permission denied)
- Check failed: status.ok() Failed to open leveldb IO error: /LOCK: Permission denied
- curl: (7) Failed connect to localhost:18001; 拒绝连接
- 解决Nginx的connect() to xxx.xx.xxx.xxx:2345 failed (13: Permission denied) while connecting to upstream
- Error -27796: Failed to connect to server
- Target failed to run: Permission to debug *** was denied.
- failed to copy 'tcpdump' to '/data/local/tcpdump': Permission denied
- iOS - error: failed to launch '/private/var/mobile/Applications ' -- Permission denied :
- jstl标签中的fn与fmt标签的用法
- 移动端自定义提示框
- ActionBarSherlock 和 SlidingMenu 在Eclipse中的引入和使用
- RxJava 学习笔记(四)
- Laravel 日志
- CURL ERROR 7 Failed to connect to Permission denied
- Android应用在未启动的情况下无法收到指定广播的问题总结
- MySQL单台物理机上单实例多库与多实例单库性能测试
- Git ssh key的生成,由于SSH配置文件的不匹配,导致的Permission denied (publickey)及其解决方法
- activity 转化成dialogactivity
- iOS 通过网址URL scheme传值
- Android入门基础:从这里开始
- DLL常用函数
- Java 基础部面试