【问题标题】:Live Server cannot load other pages with Apache 404 errorLive Server 无法加载其他页面并出现 Apache 404 错误
【发布时间】:2020-03-06 09:27:23
【问题描述】:

我在 Google Cloud Platform 上使用 Google VM 实例来运行我的实时服务器。我也在使用 CodeIgniter 来构建我的服务器。进入页面时可以加载默认路由,但是进入其他路由时,显示Apache 404错误:

找不到

在此服务器上找不到请求的 URL。

Apache/2.4.29 (Ubuntu) 服务器位于 35.186.147.249 端口 80

我的 Apache 配置文件位于 /etc/apache2/sites-available:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/html

    <Directory /var/www/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride All
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

我在网上查了一下,大多数人都说这是 Apache 的问题,但我不太确定。我将共享任何文件以解决此问题。

【问题讨论】:

    标签: php apache2 codeigniter-3


    【解决方案1】:

    DocumentRoot /var/www/html 行确定了您的文件的基础,我查看了您放置的 IP,我可以看到下一个文件夹并正确访问:

    • j/
    • 医学调查/
    • 温度/

    这里是link 以了解有关 DocumentRoot 的更多信息,因此您可以定义您需要 Web 文件的默认文件夹路径的位置。如果您需要有不同的 Web 开发链接,您可以按照此link 配置虚拟主机。希望这就是您想要的。

    【讨论】:

      猜你喜欢
      • 2012-02-23
      • 2013-10-03
      • 1970-01-01
      • 2020-12-11
      • 1970-01-01
      • 1970-01-01
      • 2017-12-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多