Apache -Apache 2 Debian默认页面而不是我的网站

polhcujo  于 2023-05-01  发布在  Apache
关注(0)|答案(5)|浏览(384)

我在Debian上有一个Apache 2,我是初学者(新手)。当在Web浏览器中访问我的Web服务器时,我得到Apache默认的欢迎页面:

而不是这个页面(位于var/www/html),我试图使我的真实的网站显示(var/www/mywebsite。com/)。下面是我的服务器上的树:

---- 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 webmaster@mywebsite.com

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默认页面仍然在这里。我错过了什么?

4sup72z8

4sup72z81#

删除索引。超文本标记语言
您的index.html位于/var/www/html

  1. cd /var/www/html
  2. sudo chown -R whoami /var/www/html
  3. rm index.html
  4. ls
jvidinwx

jvidinwx2#

您的index.html位于/var/www/mywebsite.com/web,我猜这是网站的根文件夹?试试这个配置:

DocumentRoot /var/www/mywebsite.com/web
k5ifujac

k5ifujac3#

我找到解决办法了
Apache加载的唯一的 *.conf文件是etc/apache 2/sites-available/000-default。conf,然后我在这个文件上工作,以解决我的问题。
希望将来能帮助到别人!

vd2z7a6w

vd2z7a6w4#

只是删除这两个文件索引。HTML和索引。nginx-debian。html从这个路径/var/www/html .……很好

gdx19jrr

gdx19jrr5#

你不需要删除任何东西。您可以简单地更新索引。新的html/css/js内容。请记住,更改不会反映,直到您重新启动Debian。有一个选项可以立即查看更新,但它是另一个命令。

相关问题