[英]Live Server cannot load other pages with Apache 404 error
I'm using Google VM instances on Google Cloud Platform for running my live server.我在 Google Cloud Platform 上使用 Google VM 实例来运行我的实时服务器。 I'm also using CodeIgniter to build of my server.
我也在使用 CodeIgniter 来构建我的服务器。 It can load the default route when entering the page but when going to other routes, it shows Apache 404 error:
进入页面时可以加载默认路由,但进入其他路由时,显示Apache 404错误:
Not Found
未找到
The requested URL was not found on this server.
在此服务器上找不到请求的 URL。
Apache/2.4.29 (Ubuntu) Server at 35.186.147.249 Port 80
Apache/2.4.29 (Ubuntu) 服务器在 35.186.147.249 端口 80
My Apache config file at /etc/apache2/sites-available
:我的 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>
I looked up online and most people say it is an Apache problem but I'm not too sure.我在网上查了一下,大多数人说这是 Apache 问题,但我不太确定。 I'll share any of the files in order to fix this issue.
我将共享任何文件以解决此问题。
The line DocumentRoot /var/www/html determinate the base of your files, I reviewed the IP that you put and i can see the next folder and access correctly:行 DocumentRoot /var/www/html 确定文件的基础,我查看了您放置的 IP,我可以看到下一个文件夹并正确访问:
Here is the link to understand more about DocumentRoot, so you can define where you require the default folder route for your web files.这是了解有关 DocumentRoot 的更多信息的链接,因此您可以定义 Web 文件需要默认文件夹路径的位置。 In case you require to have different links of your web development you can follow this link to configure the virtual hosts.
如果您需要不同的 Web 开发链接,您可以按照此链接配置虚拟主机。 Hope this is what you were looking for.
希望这就是你要找的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.