我在 Debian 上有一个 Apache 2 并且是初学者(新手)。 在网络浏览器中访问我的网络服务器时,我看到 Apache 默认欢迎页面:
我尝试显示我的真实网站(var/www/mywebsite.com/),而不是这个页面(位于 var/www/html)。下面是我服务器上的树:
---- etc
-------- apache2
------------ sites-enabled
---------------- mywebsite.com.vhost -> etc/apache2/sites-available/mywebsite.com.vhost
------------ sites-available
---------------- mywebsite.com.vhost
---- var
-------- www
------------ mywebsite.com
---------------- web
-------------------- css/
-------------------- js/
-------------------- img/
-------------------- error/
-------------------- index.html
-------------------- robots.txt
我的 .vhost 文件配置良好:
AllowOverride None
Require all denied
DocumentRoot /var/www/mywebsite.com
ServerName mywebsite.com
ServerAlias www.mywebsite.com
ServerAdmin [email protected]
ErrorLog /var/log/ispconfig/httpd/mywebsite.com/error.log
Alias /error/ "/var/www/mywebsite.com/web/error/"
ErrorDocument 400 /error/400.html
ErrorDocument 401 /error/401.html
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 405 /error/405.html
ErrorDocument 500 /error/500.html
ErrorDocument 502 /error/502.html
ErrorDocument 503 /error/503.html
<Directory /var/www/mywebsite.com/web>
# Clear PHP settings of this website
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler None
</FilesMatch>
Options +FollowSymLinks
AllowOverride All
Require all granted.
</Directory>
.. 我重新启动了 Apache。没有成功! Apache 默认页面仍然在这里。我错过了什么?
删除 index.html
你的
index.html
位于/var/www/html
cd /var/www/html
sudo chown -R
whoami /var/www/html
rm index.html
ls
你的
index.html
位于/var/www/mywebsite.com/web
,我猜这是网站根文件夹?试试这个配置:
DocumentRoot /var/www/mywebsite.com/web
我找到了解决方案。
Apache 加载的唯一 *.conf 文件是 etc/apache2/sites-available/000-default.conf,然后我处理这个文件来解决我的问题。
希望将来能对某人有所帮助!
只需从这个路径 /var/www/html 中删除这两个文件 index.html 和 index.nginx-debian.html ....好
你不需要删除任何东西。您可以简单地用新的 html/css/js 内容更新 index.html。请记住,在您重新启动 Debian 之前,更改不会反映出来。有一个选项可以立即查看更新,但这是另一个命令。