Ubuntu搭建Http服务器用于下载Ubuntu文件
2024-08-23 00:53:00
首先安装Apache
$ sudo apt-get install apache2
Apache2的默认访问端口为80,当端口被占用时需要更改其访问端口
进入apache2的安装目录 /etc/apache2/,修改器ports.conf文件
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/-default.conf #Listen
Listen <IfModule ssl_module>
Listen
</IfModule> <IfModule mod_gnutls.c>
Listen
</IfModule> # vim: syntax=apache ts= sw= sts= sr noet
进入 目录 /etc/apache2/sites-available, 修改000-default.conf文件
#<VirtualHost *:>
<VirtualHost *:>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com ServerAdmin webmaster@localhost
DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost> # vim: syntax=apache ts= sw= sts= sr noet
然后重启apache服务器
$ sudo /etc/init.d/apache2 restart
apache服务器的默认目录在/var/www/html,如果想利用http服务器下载文件,需要删除其index.html文件,然后把文件放在该目录即可
但是点击以后又出现一个新问题
You don't have permission to access /config on this server,意识到没有把文件压缩,它是打开了这个网页。把文件压缩就可以下载了
最新文章
- display:none显示和隐藏
- GO语言练习:channel 工程实例
- Hya.io – 基于 Web 的数字音频工作站
- oracle 索引失效原因及解决方法
- ADO.NET事务处理,初始回调函数,多张表的数据在同一个DataGridView中展示
- 微软职位内部推荐-SDEII for Windows Phone Apps
- 【Unity3D实战】摇摆直升机开发实战(一)
- JAVA面试题集之基础知识
- LA 4329
- SAP标准教材列表
- order by 中 使用decode
- Lucene 4.4.0中常用的几个分词器
- 7、Kafka、AMQ、RabbitMQ对比
- redis 启动停止脚本
- 【机器学习算法-python实现】採样算法的简单实现
- Eclipse 在Debug调试中用到的快捷键
- Java:The hierarchy of the type is inconsistent错误
- Springmvx拦截html出现406解决以及Server Tomcat v8.0 Server at localhost failed to start 问题解决方法
- Makefile中的MAKECMDGOALS
- CoreDNS配置etcd作为后端