安装nginx
开始解压nginx
[root@localhost src]# tar -zxf nginx-1.11.5.tar.gz
创建用户和属组
[root@localhost src]# groupadd nginx
[root@localhost src]# useradd -s /sbin/nologin -M -g nginx nginx nginx
进入 nginx包
root@localhost src]# cd nginx-1.11.5
编译和安装
[root@localhost nginx-1.11.5]# ./configure --prefix=/data/server/nginx --user=nginx --group=nginx
[root@localhost nginx-1.11.5]# make && make install
优化路径
[root@localhost nginx-1.11.5]# ln -s /data/server/nginx/sbin/nginx /usr/local/sbin/
进行编写
[root@localhost nginx-1.11.5 ]# vim nginx.conf
重启nginx和关闭防火墙
[root@localhost sbin]# ./nginx
[root@localhost sbin]# systemctl stop firewalld
游览器登录自己的IP