Bootstrap

linux安装nginx遇到的报错

1、Linux如何修改只读文件(以设置自动连网为例)

vim /etc/sysconfig/network-scripts/ifcfg-ens33

然后提示

E45:已设定选项“readonly”(请加!强制执行) 

如果需要强制修改,可以使用,注意空格

:w !sudo tee %

2、安装报错

已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.cmich.edu
 * extras: nocix.mm.fcix.net
 * updates: mirrors.ocf.berkeley.edu
没有可用软件包 nginx。
错误:无须任何处理

 //安装epel-release软件包

sudo yum install epel-release
//再次安装即正常
sudo yum install nginx

3、nginx启动报错

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
 

查看端口

lsof -i:80

关闭:

sudo fuser -k 80/tcp

4、访问不到端口

查看防火墙

systemctl status firewalld

1、启用:systemctl start firewalld
2、关闭:systemctl stop firewalld

查看ip

ip addr

连接

;