我正在尝试创建一个 lamp-server 数据库。当我转到本地主机在我的浏览器中,默认的 apache“它正在工作”页面会显示。但是当我尝试使用本地主机/帖子我收到错误消息 404。Posts 是名为 cake 的数据库中的一个表。
我尝试过多次删除所有内容并从头开始。这是我正在遵循的教程:Swift:使用外部数据库和 API 第 1 部分:设置服务器
这些是我的配置文件。Apache2.conf
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
var/www.
<Directory />
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
还有cake.conf:
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
<VirtualHost *:80>
ServerName localhost
DocumentRoot /home/skip/cake/
<Directory /home/skip/cake/>
Options FollowSymLinks
AllowOverride All
</Directory>
CustomLog /var/log/apache2/cake-access.log combined
ErrorLog /var/log/apache2/cake-error.log
LogLevel debug
<FilesMatch \"\.(cgi|shtml|phtml|php)$\">
</FilesMatch>
BrowserMatch \"MSIE [2-6]\" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch \"MSIE [17-9]\" ssl-unclean-shutdown
</VirtualHost>
答案1
问题在于文件夹权限。检查应用程序文件夹的文件夹和文件权限。同时验证路径。