0

刚刚获得了我的 VPS 和域用于一个宠物项目。我设置了 Apache 和 PHP,一切正常,直到我将我的公共 IP 放到 URL 中。它重定向到DocumentRoot我的一组VirtualHost

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin webmaster@mydomain.com
  ServerName  mydomain.com
  ServerAlias www.mydomain.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/mysite
  <Directory /var/www/mysite>
    AllowOverride All
    Allow from mydomain.com
    Allow from www.mydomain.com
  </Directory>
  # Log file locations
  LogLevel warn
  ErrorLog  /home/me/public/mydomain.com/log/error.log
  CustomLog /home/me/public/mydomain.com/log/access.log combined
</VirtualHost>

我需要调整什么,以便每次在 URL 上输入我的公共 IP 时,它只会重定向到默认值It works! // /var/www/index.html

4

1 回答 1

0

您只需要更改全局DocumentRoot点的位置httpd.conf

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/"

并更改中的值directory

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www">
    Options -Indexes +FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
于 2012-09-04T16:51:27.063 回答