Nginx infinite warmup loop because "allowoverride all" or no rewritting
While trying to do this: setup/warmup
I encountered this error:
Trying to setup known but at the warmup/?stage=settings I get stuck in a loop instead of going onwards. Not sure what I can do to fix this.
Rewriting appears to be disabled. Usually this means "AllowOverride None" is set in apache2.conf which prevents Known's .htaccess from doing its thing. We tried to fetch a URL that should redirect to known.min.js
You can usually fix this by setting AllowOverride All in your Apache configuration.
Some other notes:
Give us some context:
Nginx 1.17.8 php7.4
my nginx config for known
## END Known Webserver Config (don't remove)
server {
listen 80;
listen [::]:80;
server_name known.known.server;
client_max_body_size 20M;
root /usr/share/webapps/known;
index index.php;
open_file_cache max=2000 inactive=20s;
open_file_cache_valid 60s;
open_file_cache_min_uses 5;
open_file_cache_errors off;
location ~* \.(css|js|jpg|jpeg|gif|png|ico|xml)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
rewrite ^/css/[0-9]+/(.*) /css/$1 last;
rewrite ^/js/[0-9]+/(.*) /js/$1 last;
try_files $uri $uri/ /index.php?$query_string;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $http_host;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param PHP_VALUE "cgi.fix_pathinfo=0 \n upload_max_filesize=1000M \n post_max_size=1080M";
fastcgi_intercept_errors on;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location ~* \.(xml|ini|json|lock|bak)$ {
deny all;
}
location /configuration/ {
deny all;
}
location /\.git(|hub)/ {
deny all;
}
}
## BEGIN Known Webserver Config (don't remove)
- It'd also be really handy if you could tell us the contents of your
version.knownfile
version = '1.0.0' build = 2019102701 revision = "a8a5af7"
- What database are you using?
mysql
trying to place settings manually into config.ini results in a 404 at /begin/
You need to set up url rewriting for Nginx.
If you are installing in a subdir you might need to set whatever the Nginx equivalent of RewriteBase is. Nginx isn't a massively well trodden path.
Nothing seems to be missing, just arranged differently.
location / { try_files $uri $uri/ /index.php?$query_string; }
should cover the rewriting
My setup has the css / js separated from each other:
location /css/ { rewrite ^/css/[0-9]+/(.) /css/$1 last; } location /js/ { rewrite ^/js/[0-9]+/(.) /js/$1 last; }
@cdn Love a PR :)
@mapkyca will have to see how a Known install responds to a config more like the example