I am trying to set up Flarum in a subdirectory of my site, /community/.
I managed to run throught the setup just fine, but after the setup, I only get the error:
500 Internal Server Error
Something went wrong on our server.
If I make a phpinfo.php file in the /community/ directory, I can access it just fine. When I check the error logs in /var/www/logs/example.error.log, there is nothing new when I refresh the page.
Here is my Nginx config:
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
# Let's Encrypt stuff...
ssl_certificate /etc/letsencrypt/live/example.ca/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.ca/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
# Redirect to www
if ($host = "example.ca") {
return 301 https://www.example.ca$request_uri;
}
# Accepted domains
server_name example.ca www.example.ca;
root /var/www/example.ca;
index index.php index.html;
##
# Community forum
#
location ~* ^/community/(composer\.(json|lock)|config\.php|flarum|storage|vendor) {
deny all;
return 404;
}
location /community/ { try_files $uri $uri/ /community/index.php?$query_string; }
location /community/api { try_files $uri $uri/ /community/api.php?$query_string; }
location /community/admin { try_files $uri $uri/ /community/admin.php?$query_string; }
location ~* ^/community/(.*)\.php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTP_PROXY ""; # Fix for https://httpoxy.org/ vulnerability
fastcgi_index index.php;
}
location ~* ^/community/(.*)\.html$ {
expires -1;
}
location ~* ^/community/(.*)\.(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/html -- text/html is gzipped by default by nginx
text/plain
text/xml;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
#
# / Community forum
##
error_page 404 /404.php;
location /404.php {
root /var/www/example.ca;
}
location / {
root /var/www/example.ca;
index index.php index.html index.htm;
rewrite "^/sitemap.xml$" /sitemap.php last;
}
# While in DEV: remove this after.
location /plugins/ {
add_header Cache-Control no-cache;
}
access_log /var/www/logs/example.access.log;
error_log /var/www/logs/example.error.log;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location ~ /.well-known {
allow all;
}
location ~* \.(jpg|jpeg|png|gif|ico)$ {
# expires 365d;
}
}
Have I done something wrong? If not, where can I start debugging?
Edit: I should add that
1) https://www.example.ca/community/admin gives a 500 error as well
2) https://www.example.ca/community/index.php gives a 404 error, using Flarum's 404 page (simple text).
3) https://www.example.ca/community/api gives {"errors":[{"status":"404","code":"route_not_found"}]}