-1

我在删除 VirtualHost 时遇到问题,所以我只想简单地编辑 /etc/apache2/sites-available/default 文件。事实证明,我正在尝试添加原始的“index.html”文件,该文件位于 /var/www/ 目录中。但它不起作用,因为另一个 VirtualHost 占用了端口 80,我没有在默认文件中看到我的“index.html”文件。我非常沮丧,所以我正在考虑重新安装 apache2 服务。但即使我使用此命令将其删除:

 sudo apt-get install --remove apache2 php5 libapache2-mod-php5

即使我这样做了,它也没有被删除,并且在过程结束时我得到了这个错误:

 Errors were encountered while processing:
  libopenvnc-imgproc2.3
  libavfilter2:armhf
  libav-tools
  ffmpeg
 E: Sub-process /usr/bin/dpkg returned an error code (1)

有什么方法可以全新安装 apache2 以及 php5 和 libapache2-mod-php5,因为我在第一次获得 Pi 时已经安装了它们?我只是迷路了,我已经去了一百万个论坛,但没有一个能帮助我......

这是“默认”文件文本:

 NameVirtualHost *:8091
 NameVirtualHost *:80
 NameVirtualHost *:443

这是我尝试做的,但没有奏效,它说找不到文件!

 <VirtualHost *:80>
DocumentRoot /var/www/remote_replay.php 
ServerName 192.168.1.80  
 </VirtualHost>

下面的这部分工作正常,但我想把它删除!!!!!!

 WSGIDaemonProcess web2py user=www-data group=www-data

 <VirtualHost *:8091>
 WSGIProcessGroup web2py
 WSGIScriptAlias / /home/www-data/web2py/wsgihandler.py
 WSGIPassAuthorization On

 <Directory /home/www-data/web2py>
 AllowOverride None
 Order Allow,Deny
 Deny from all
 <Files wsgihandler.py>
  Allow from all
 </Files>
 </Directory>

 AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) \
       /home/www-data/web2py/applications/$1/static/$2
 <Directory /home/www-data/web2py/applications/*/static/>
 Options -Indexes
 Order Allow,Deny
 Allow from all
 </Directory>

 <Location /admin>
 Deny from all
 </Location>

 <LocationMatch ^/([^/]+)/appadmin>
 Deny from all
 </LocationMatch>

 CustomLog /var/log/apache2/access.log common
 ErrorLog /var/log/apache2/error.log
 </VirtualHost>

 <VirtualHost *:443>
 SSLEngine on
 SSLCertificateFile /etc/apache2/ssl/self_signed.cert
 SSLCertificateKeyFile /etc/apache2/ssl/self_signed.key

 WSGIProcessGroup web2py
 WSGIScriptAlias / /home/www-data/web2py/wsgihandler.py
 WSGIPassAuthorization On

 <Directory /home/www-data/web2py>
 AllowOverride None
 Order Allow,Deny
 Deny from all
 <Files wsgihandler.py>
  Allow from all
 </Files>
 </Directory>

 AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) \
    /home/www-data/web2py/applications/$1/static/$2

 <Directory /home/www-data/web2py/applications/*/static/>
 Options -Indexes
 ExpiresActive On
 ExpiresDefault "access plus 1 hour"
 Order Allow,Deny
 Allow from all
 </Directory>

 CustomLog /var/log/apache2/access.log common
 ErrorLog /var/log/apache2/error.log
 </VirtualHost>
4

1 回答 1

1

你的虚拟主机配置有问题,DocumentRoot一定是目录。如果要提供特定文件,请使用DocumentIndex以按优先顺序指定要使用的文件:

<VirtualHost *:80>
  DocumentRoot /var/www/
  DocumentIndex remote_replay.php index.php index.html index.htm
  ServerName 192.168.1.80  
</VirtualHost>
于 2013-07-15T02:44:31.093 回答