如何将HTML文件上传到在Docker上运行的Apache Web服务器
我从Apache Web服务开始。我正在使用HTTPD图像在Docker上运行它,并且在容器上绘制了主机端口81至80。
我已经创建了一个新的index.html,我想测试它作为我的新主页,但对于如何将其上传到服务器而言是一定的。
我不知道有任何GUI类型的方法,但无论如何都希望采用程序化方法。
我尝试使用卷曲命令(一些变体的反复试验)。一个例子是:
curl -u root -XPUT -H "content-type: application/html" @index.html http://localhost:81/index.html
有时返回现有索引。
I am starting out with Apache webservices. I am running it on Docker with the httpd image, and I have mapped host machine port 81 to 80 on the container.
I have created a new index.html which I want to test as my new home page, but at a loss as to how to upload it to the server.
I'm not aware of any GUI type methods, but in any case would prefer a programmatic approach.
I have tried using curl commands (trial and error of a few variations). One example is:
curl -u root -XPUT -H "content-type: application/html" @index.html http://localhost:81/index.html
Sometimes the existing index.html is returned, other times I get Error 405: Method Not Allowed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
Docker CP
Docker cp ./index.html容器:/var/www/html/index.html
适应您的需求;要获取容器名称,请运行
Docker PS
。如果您的容器命名为Apache2,则完整命令将为:Docker cp ./index.html apache2:/var/www/html/index.html
Use
docker cp
docker cp ./index.html container:/var/www/html/index.html
Adapt paths to your needs; to obtain container name, run
docker ps
. If your container is named apache2, then full command will be:docker cp ./index.html apache2:/var/www/html/index.html