一.关闭防火墙和SElinuxhtml
systemctl stop firewalld setenforce 0
二.源码安装NGINX
下载源码包并解压:linux
wget http://nginx.org/download/nginx-1.16.0.tar.gz tar -zxvf nginx-1.16.0.tar.gz
三.编译安装nginx
cd /usr/local/src cd nginx-1.16.0 ./configure --prefix=/data/server/nginx make && make install
进到NGINX目录中启动NGINXvim
cd /data/server/nginx/sbin ./nginx
在网页输入IP:
配置目录索引浏览器
vim xxx
在其中放入安装连接http://nginx.org/en/download.htmlide
3.配置文件
vim /data/server/nginx/conf/nginx.confcode
在server模块下添加 autoindex on; autoindex_exact_size off; autoindex_localtime on; root /var/www/html; 在location下添加 autoindex on; autoindex_exact_size off; autoindex_localtime on;
4.进到启动nginx的目录
cd /data/server/nginx/sbinserver
5.重读nginx
./nginx -s reload
6.在浏览器输入iphtm