现在服务器部署nginx
1yum install -y epel-release 2yum install nginx -y
安装完成之后
访问ip
由此可见nginx服务是可用的
修改nginx的配置文件如下
1root@localhost conf.d]# pwd 2/etc/nginx/conf.d 3[root@localhost conf.d]# cat default.conf 4server { 5 listen 80; 6 server_name localhost; 7 root /home/www; 8 9 #access_log /var/log/nginx/host.access.log main; 10 11 location / { 12 autoindex on; # 索引 13 autoindex_exact_size on; # 显示文件大小 14 autoindex_localtime on; # 显示文件时间 15 } 16 #error_page 404 /404.html; 17 error_page 500 502 503 504 /50x.html; 18 location = /50x.html { 19 root /usr/share/nginx/html; 20 } 21} 22[root@localhost conf.d]# 23
修改root指向的位置 添加这三项
1autoindex on; # 索引 2autoindex_exact_size on; # 显示文件大小 3autoindex_localtime on; # 显示文件时间
修改好配置之后 重启nginx 服务
1nginx -t 2nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 3nginx: configuration file /etc/nginx/nginx.conf test is successful 4nginx -s reload
在root指向目录放入文件 访问ip
访问图片 至此图片服务部署完成
微信公众号:[Kubernetes中文社区] 关注容器技术、关注
Kubernetes。每天技术文章分享。 回复关键字视频、Kubernetes、docker、获取视频学习资料
