使用阿里云服务器搭建远程可访问的文件服务器
Posted lrw998
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用阿里云服务器搭建远程可访问的文件服务器相关的知识,希望对你有一定的参考价值。
Apache HTTP服务器是世界上使用最广泛的Web服务器。 它提供了许多强大的功能,包括动态加载模块,强大的媒体支持,以及与其他流行软件的广泛集成。
在本文章中,我们将讨论如何在Ubuntu 16.04服务器上安装Apache Web服务器。
Apache2通过apt命令来安装
sudo apt-get install apache2
Apache2的默认访问端口为80,通常需要为它分配一个不被占用的端口,这里我使用8001端口:
要使用一个新的端口,就肯定要启动此端口:
sudo ufw allow 8001
进入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/000-default.conf #Revised by wanglu on 2020-03-01 #Listen 80 Listen 8001 <IfModule ssl_module> Listen 443 </IfModule> <IfModule mod_gnutls.c> Listen 443 </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
进入 目录 /etc/apache2/sites-available, 修改000-default.conf文件
#Revised by Wang Lu on 2020-03-01 #<VirtualHost *:80> <VirtualHost *:8001> # 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=4 sw=4 sts=4 sr noet
修改完成后重启apache服务
sudo /etc/init.d/apache2 restart
apache服务器的默认目录在/var/www/html,可以在000-default.conf中修改
如果想利用http服务器下载文件,需要删除其index.html文件,因为它默认会显示html页面,然后把文件放在该目录即可
ENJOY IT!
以上是关于使用阿里云服务器搭建远程可访问的文件服务器的主要内容,如果未能解决你的问题,请参考以下文章