安装nginx
最快直接使用yum进行安装
代码语言:javascript复制[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# yum -y install nginx
创建存放文件/图片的目录
代码语言:javascript复制[root@localhost ~]# mkdir -p /data/file
导入图片
代码语言:javascript复制[root@localhost file]# ls
csdn.jpg csdn.txt
修改nginx配置文件
代码语言:javascript复制[root@localhost ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@localhost ~]# vi /etc/nginx/nginx.conf
启动nginx
代码语言:javascript复制[root@localhost ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@localhost ~]# nginx
[root@localhost ~]# nginx -s reload
关闭防火墙、测试访问
代码语言:javascript复制[root@localhost ~]# systemctl stop firewalld
curl:http://192.168.1.40/file/