Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Nginx 404
Minnit
New
I'm trying to install vanilla forums but I keep on getting a 404 from nginx.
This is what I currently have set:
server_tokens off; add_header X-Content-Type-Options nosniff; add_header X-XSS-Protection "1; mode=block"; server { listen 80; root /var/www/public; index index.php; server_name example.com 10.0.1.25; error_page 404 /404.html; error_page 500 /500.html; location /forum { # /index.php handler location ~* "^/index\.php(/|$)" { include fastcgi_params; fastcgi_param X_REWRITE 1; fastcgi_intercept_errors on; fastcgi_pass unix:/run/php/php7.1-fpm.sock; } location ~* "\.php(/|$)" { rewrite ^ /index.php$uri last; } try_files $uri $uri/ /index.php?p=$uri&$args; } }
This is what fastcgi_params is set to:
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 $request_filename; 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 GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 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 $host; fastcgi_param HTTPS $https if_not_empty; fastcgi_param PHP_VALUE "session.cookie_httponly=on;\n error_reporting=E_ALL;\n display_errors=on;"; # PHP only, required if PHP was built with --enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200;
Can anyone help me fix this? Thanks
0
Answers
Post your htaccess file contents.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
I'm using nginx so htaccess wouldn't matter. htaccess would matter if I was using apache
I'm no nginx wizard, but if you see 404 error, I would say that your "location" instructions are wrong. The fastcgi part would only be of interest if the php file couldn't be processed, wouldn't it?
Based on some old posting here on the forum, I'm working with the following location instructions without any problems:
I've never used a location block, but using the above and mixing it with your content, I would advice trying the following
I really don't know if you need to add
fastcgi_split_path_info ^(.+\.php)(/.+)$;
or if you have to leave outfastcgi_param X_REWRITE 1;
or a mixture of bothWhen I tried that I got this error: "nginx: [emerg] named location "@vanilla" can be on the server level only in /etc/nginx/sites-enabled/default:18"
So I tried this:
This configuration results in a 500 internal server error saying "Something has gone wrong.
We've run into a problem and are unable to handle this request right now.
Please check back in a little while."
If I leave out fastcgi_split_path_info, it still gives 500 internal server error. If I include X_REWRITE, I get a redirect loop (even if fastcgi_split_path_info is excluded)
On the bright side I'm not getting a 404 anymore, though a 500 is not that much better.
Any ideas on how I can fix it?
Thanks again
Add this to your server configuration:
The error log should be able to help you
@R_J
I tried that and the access_log works, but nothing is displayed in the error_log.
This is what I see in the access_log:
Any ideas?
@R_J
This got caught in the spam queue.
Not quite sure what is happening. Please do the following two things:
1. Add
$Configuration['Debug'] = true;
to your /conf/config.php2. Edit /index.php and change
ini_set('display_errors', 0);
toini_set('display_errors', 1);
I hope that it will show more information on failure...
@R_J
This does give me more information:
Backtrace:
[/var/www/public/forum/library/database/class.database.php:102] Gdn_Database->newPDO();
[/var/www/public/forum/library/database/class.database.php:502] Gdn_Database->connection();
[/var/www/public/forum/library/database/class.database.php:368] Gdn_Database->slave();
[/var/www/public/forum/library/database/class.sqldriver.php:1663] Gdn_Database->query();
[/var/www/public/forum/library/database/class.sqldriver.php:884] Gdn_SQLDriver->query();
[/var/www/public/forum/library/core/class.authenticationprovidermodel.php:168] Gdn_SQLDriver->getWhere();
[/var/www/public/forum/library/core/class.authenticationprovidermodel.php:57] Gdn_AuthenticationProviderModel::getWhereStatic();
[/var/www/public/forum/library/core/functions.render.php:1146] Gdn_AuthenticationProviderModel::getDefault();
[/var/www/public/forum/library/core/class.theme.php:341] PHP::signInUrl();
[/var/www/public/forum/library/vendors/SmartyPlugins/function.signinout_link.php:20] Gdn_Theme::link();
[/var/www/public/forum/cache/Smarty/compile/vanilla^%%A9^A94^A948A472%%default.master.tpl.php:37] PHP::smarty_function_signinout_link();
[/var/www/public/forum/library/vendors/smarty/libs/Smarty.class.php:1257] PHP::include();
[/var/www/public/forum/library/vendors/smarty/libs/Smarty.class.php:1107] Smarty->fetch();
[/var/www/public/forum/library/core/class.smarty.php:138] Smarty->display();
[/var/www/public/forum/library/core/class.controller.php:1855] Gdn_Smarty->render();
[/var/www/public/forum/library/core/class.controller.php:1314] Gdn_Controller->renderMaster();
[/var/www/public/forum/library/core/class.pluggable.php:199] Gdn_Controller->xRender();
[/var/www/public/forum/applications/dashboard/controllers/class.homecontroller.php:93] Gdn_Pluggable->__call();
[/var/www/public/forum/library/core/class.dispatcher.php:326] HomeController->fileNotFound();
[/var/www/public/forum/index.php:44] Gdn_Dispatcher->dispatch();
I'm still not entirely sure what the issue is. PDO is installed and works, so I don't think it's that
Please ensure all database settings are correct and that you choose "localhost" for your db server
This is the first time I'm setting up the forum
I created a database for it and set up the DB credentials, but it gives this error:
Table 'forum.GDN_UserAuthenticationProvider' doesn't exist
I thought that /dashboard/setup would create the required tables, but it just returns that error.
What page do I need to go to to create the tables?
You never told what screens you already have seen when errors arise. If this is a clean installation, make sure it really looks clean for Vanilla too
a) delete all tables form that database
b) delete /conf/config.php
c) delete all *.ini files in /cache
I got it working with the newer 2.5 version of Vanilla.
Thanks for helping!