1、yum install nginx -y#安裝nginx 根據(jù)提示輸入y進(jìn)行安裝
2、chkconfig nginx on#設(shè)置nginx開(kāi)機(jī)啟動(dòng)
3、service nginx start
啟動(dòng)的時(shí)候會(huì)報(bào)下邊的錯(cuò)誤
Starting nginx: nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
[FAILED]
進(jìn)入nginx目錄,cd /etc/nginx/conf.d/
編輯配置文件? vim default.conf
配置文件修改
修改監(jiān)聽(tīng)端口為80,服務(wù)器名字設(shè)置為ip地址
在瀏覽器訪問(wèn)ip地址,顯示W(wǎng)elcome tonginxon EPEL!
nginx配置完畢