1、nginx: [emerg] bind() to 0.0.0.0:80 failed (13: permission denied)
回答:
the socket API bind() to a port less than 1024, such as 80 as your title mentioned, need root access.
here is “Bind to ports less than 1024 without root access”
and another easier way is to run nginx as root.
解决方案:
修改端口为8080
2、解决Nginx出现403 forbidden (13: Permission denied)报错的三种办法
1)、缺少index.html或者index.php文件,就是配置文件中index index.html index.htm这行中的指定的文件。
server {
listen 80;
server_name localhost;
index index.php index.html;
root /data/www/;
}
如果在/data/www/下面没有index.php,index.html的时候,直接文件,会报403 forbidden。
2)、权限问题,如果nginx没有web目录的操作权限,也会出现403错误。
解决办法:修改web目录的读写权限,或者是把nginx的启动用户改成目录的所属用户,重启Nginx即可解决
chmod -R 777 /data
chmod -R 777 /data/www/
3) 、SELinux设置为开启状态(enabled)的原因。
3.1、查看当前selinux的状态。
/usr/sbin/sestatus
3.2、将SELINUX=enforcing 修改为 SELINUX=disabled 状态。
vi /etc/selinux/config
#SELINUX=enforcing
SELINUX=disabled
3.3、重启生效。reboot。
reboot
我这里出现错误的问题就是在第三步设置SELinux的问题上,折腾我好长时间。