大型旅游网站,云计算培训机构,企业内部网站设计,全球访问量最大的网站centos下利用httpd搭建http服务器方法 1. 解决的问题 在开发测试过程中#xff0c;分析图片任务需要将图片保存在服务器端#xff0c;通过url来访问和下载该图片#xff0c;这就需要使用一台图片服务器#xff0c;但常常遇到图片服务器匮乏的情况#xff0c;为了解决该问题…centos下利用httpd搭建http服务器方法 1. 解决的问题 在开发测试过程中分析图片任务需要将图片保存在服务器端通过url来访问和下载该图片这就需要使用一台图片服务器但常常遇到图片服务器匮乏的情况为了解决该问题可以临时在自己电脑上搭建一个简易的图片服务器以供使用。本文给出了一种在centos系统上利用httpd搭建简易图片服务器的方法。 2. 搭建步骤 1安装httpd服务 在centos操作系统下执行shell命令 yum install httpd -y 安装完成后可通过命令whereis httpd查看安装位置 [rootlocalhost ld]# whereis httpd
httpd: /usr/sbin/httpd /usr/lib64/httpd /etc/httpd /usr/share/httpd /usr/share/man/man8/httpd.8.gz rpm -qi httpd命令查看httpd的版本信息[rootlocalhost ld]# rpm -qi httpd Name : httpd Version : 2.4.6 Release : 80.el7.centos.1 Architecture: x86_64 Install Date: Mon 27 Aug 2018 02:10:31 PM CST Group : System Environment/Daemons Size : 9817285 License : ASL 2.0 Signature : RSA/SHA256, Tue 03 Jul 2018 10:31:55 PM CST, Key ID 24c6a8a7f4a80eb5 Source RPM : httpd-2.4.6-80.el7.centos.1.src.rpm Build Date : Wed 27 Jun 2018 09:50:38 PM CST Build Host : x86-01.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem http://bugs.centos.org Vendor : CentOS URL : http://httpd.apache.org/ Summary : Apache HTTP Server Description : The Apache HTTP Server is a powerful, efficient, and extensible web server. 2启动http服务 执行shell命令 systemctl start httpd.service 3配置文件说明 配置文件为/etc/httpd/conf/ httpd.conf有几个重要的参数需要配置 ① 端口 Listen参数默认值为80但为了避免和其他程序冲突修改为其他值。 ② 静态文件的根目录 DocumentRoot参数是需要生成url的文件存放路径。 4测试 在浏览器输入http://服务器IP:port看是否能进入HTTP样本网页如果能进入如下页面说明httpd服务器搭建成功。 5上传图片 将需要生成url的图片上传到DocumentRoot指定的目录即可在浏览器中访问和下载该图片。如保存lena.png图片在DocumentRoot指定的目录下浏览器中输入http://10.66.91.11:7777/lena.png即可访问和下载该图片。 总结 通过在centos中利用httpd服务搭建简易的图片服务器即可将任意一个待分析的图片保存到指定目录后通过url进行图片的访问和下载分析。参考 1Permission denied: make_sock: could not bind to address https://blog.csdn.net/ljm_503909378/article/details/412446592 using localhost.localdomain for ServerName https://www.cnblogs.com/52linux/archive/2012/03/24/2415637.html 转载于:https://www.cnblogs.com/walkinginthesun/p/9543001.html