我最近在我的vps上运行了一个更新,它在Ubuntu 13.10上将我的apache从2.2更新到2.4.6。
更新后,我只获得“it works”默认的apache登陆页面。
我很确定这是由于新的虚拟主机文件要求所以我尝试将.conf
扩展名添加到我的虚拟主机文件中并添加:
<Directory "/home/username/public/testapp.com/public/">
Options Indexes FollowSymLinks Includes
AllowOverride All
Require all granted
</Directory>
到文件并使用a2ensite重新启用它们并重新加载apache2。在没有获得这些尝试的任何地方后,我删除了所有已启用的网站,并开始新鲜..在/home/username/public/url.co/
中放置一个基本网站并创建一个新的虚拟主机文件:
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin admin@url.co
ServerName url.co
ServerAlias www.url.co
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/username/public/url.co/public/
# Log file locations
LogLevel warn
ErrorLog /home/username/public/url.co/log/error.log
CustomLog /home/username/public/url.co/log/access.log combined
<Directory /home/username/public/url.co/public/>
Options Indexes FollowSymLinks Includes
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
这仍然给我“它的作品”页面。我错过了这个文件明显错误的东西(它被正确命名为url.co.conf)还是有其他可能导致这个问题的东西?
答案 0 :(得分:1)
我有同样的问题!我通过在我的conf文件中添加DirectoryIndex index.html index.php
来解决它
答案 1 :(得分:0)
按照以下步骤
sudo nano /etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerName website.localhost
ServerAlias www.website.localhost
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot "/Users/Username/Sites/website"
# Log file locations
LogLevel warn
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common
<Directory /Users/Username/Sites/website>
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
允许来自Apache配置文件vhosts
的{{1}}配置:
httpd.conf
搜索“虚拟主机”并取消注释包含行:
sudo nano /etc/apache2/httpd.conf
这将允许使用HTTP,在Include /private/etc/apache2/extra/httpd-vhosts.conf
文件中输入代码,打开此文件以添加到d-vhosts.conf
中。
执行操作:vhost
并添加以下内容;
sudo nano /etc/hosts
执行:127.0.0.1 website.localhost
您可以替换ErrorLog和CustomeLog或检查sudo apachectl restart
中的错误enter code here
。