apache2 下载服务器配置

apache2 下载服务器配置

  • 新建配置文件:
sudo vi /etc/apache2/sites-available/001-download.conf

内容:

<VirtualHost *:3002>
ServerName 127.0.0.1
ServerAdmin webmaster@localhost
#这两个配置必须一致
DocumentRoot /home/android/weibiao/downloadVersion/download
#这两个配置必须一致DocumentRoot 和 Directory
<Directory /home/android/weibiao/downloadVersion/download>
Options Indexes FollowSymLinks
AllowOverride none
Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error_download.log
CustomLog ${APACHE_LOG_DIR}/access_download.log combined
</VirtualHost>

<VirtualHost *:3002>
ServerName 127.0.0.1
ServerAdmin webmaster@localhost
DocumentRoot /home/android/weibiao/downloadVersion/download
<Directory /home/android/weibiao/downloadVersion/download>
Options Indexes FollowSymLinks
AllowOverride none
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error_download.log
CustomLog ${APACHE_LOG_DIR}/access_download.log combined
</VirtualHost>

修改 /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

Listen 80
#新增的端口
Listen 3002
<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-enabled目录下面创建软链接

    sudo ln -s  ../sites-available/001-download.conf  001-download.conf
  • 重启服务器:

    sudo service apache2 restart