nginx搭建静态http静态网站
1.下载nginx源码包
[[email protected] ~] wget http://nginx.org/download/nginx-1.14.2.tar.gz
2.查看并解压源码包
[[email protected] ~] ls -l
nginx-1.14.2.tar.gz
[[email protected] ~] tar -zxvf nginx-1.14.2.tar.gz
查看解压的源码包
[[email protected] ~] ls -l
nginx-1.14.2 nginx-1.14.2.tar.gz 这里一共有两个一个是解压的一个是未解压的
3.进入nginx目录
[[email protected] ~] cd nginx-1.14.2
4.运行效验文件
[[email protected] nginx-1.14.2]# ./configure
编译
[[email protected] nginx-1.14.2]# make
安装
[[email protected] nginx-1.14.2]# make install
5.查看开启端口
[[email protected] init.d]# netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 52 192.168.1.105:22 192.168.1.102:49471 ESTABLISHED
tcp6 0 0 :::22 :::
#80端口已经开了
6.运行nginx
[[email protected] init.d]# service nginx start
Starting nginx (via systemctl): [ 确定 ]
#运行成功
6.在浏览器访问成功了
*#:[[email protected] html]# pwd
/usr/local/nginx/html
这是nginx主目录