我正在尝试在 Laravel 的子目录中设置Flarum。安装顺利,但我有一些问题。
如果我尝试访问管理面板 - > RouteCollection.php第161行中的NotFoundHttpException:
通知 - > 404 Not Found GET GET http://axiom.app/forum/api/notifications
进行讨论 - > 404 Not Found POST http://axiom.app/forum/api/discussions
用nginx运行宅基地。这是配置块
server {
listen 80;
listen 443 ssl;
server_name axiom.app;
root "/home/vagrant/Code/axiom/public";
index index.html index.htm index.php;
location /api { try_files $uri $uri/ /api.php?$query_string; }
location /admin { try_files $uri $uri/ /admin.php?$query_string; }
location /flarum {
deny all;
return 404;
}
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/axiom.app-error.log error;
sendfile off;
client_max_body_size 100m;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
}
location ~ /\.ht {
deny all;
}
location ~* \.html$ {
expires -1;
}
location ~* \.(css|js|gif|jpe?g|png)$ {
expires 1M;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types application/atom+xml
application/javascript
application/json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/xml;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
ssl_certificate /etc/nginx/ssl/axiom.app.crt;
ssl_certificate_key /etc/nginx/ssl/axiom.app.key;
}
知道怎么解决这个问题吗?提前谢谢
答案 0 :(得分:1)
找到答案。
location /api { try_files $uri $uri/ /api.php?$query_string; }
location /admin { try_files $uri $uri/ /admin.php?$query_string; }
需要相对于flarum
location /forum/api { try_files $uri $uri/ /forum/api.php?$query_string; }
location /forum/admin { try_files $uri $uri/ /forum/admin.php?$query_string; }
location /forum/ { try_files $uri $uri/ /forum/index.php?$query_string; }
最后一行需要添加到块。