我在删除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)
有没有办法在我第一次拿到我的Pi时安装apache2以及php5和libapache2-mod-php5进行全新安装?我迷失了,我去了一百万个论坛,没有人帮助过我......
以下是'默认'文件文字:
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>
答案 0 :(得分:1)
您的虚拟主机配置存在问题,DocumentRoot
必须是目录。如果要提供特定文件,请使用DocumentIndex
按优先顺序指定要使用的文件:
<VirtualHost *:80>
DocumentRoot /var/www/
DocumentIndex remote_replay.php index.php index.html index.htm
ServerName 192.168.1.80
</VirtualHost>