Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warmup goes to endless loop when hosting on dreamhost #2238

Closed
voss opened this Issue Oct 20, 2018 · 21 comments

Comments

Projects
7 participants
@voss
Copy link

commented Oct 20, 2018

While trying to do this:

Installing Known.

I encountered this error:

"Apache mod_rewrite
We couldn't detect if mod_rewrite was installed. Known cannot process page URLs without it. Proceed with caution."

Some other notes:

Give us some context:

Basically, when on a clean install on a shared host on Dreamhost, at the requirements screen of the warmup, you are told that Known wasn't able to detect the presence of mod_rewrite, and that things might get funny.

After clicking "Hooray! Let's get you set up.", and configuring the database details and then clicking on "Onwards!", I end up on /warmup/?stage=settings, with yellow highlight on top, saying

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 default.js

You can usually fix this by setting AllowOverride All in your Apache configuration.

screenshot 2018-10-20 at 15 47 54

I can put in my details once again, and hit "Onwards!" and I end up on the same page, with the same yellow highlight in the top.

According to Dreamhost, mod_rewrite is enabled on all their hosts, and sure enough, if I build my config file manually, everything works fine, including all the rewrite rules in the .htaccess file.

This is happening on PHP version 7.0.32.

  • It'd also be really handy if you could tell us the contents of your version.known file

version = 0.9.9-a
build = 2018101001

  • What database are you using? (e.g. mongo, mysql, postgres)

mysql

  • Any warnings or errors in your admin/diagnostics page?

It says:

"Your site doesn't seem to be loaded over HTTPS. We strongly recommend using HTTPS to make your site secure and protect your privacy."

  • Bonus points - are you able to illustrate the issue with a unit test? If so, submit it as a pull request!
@mapkyca

This comment has been minimized.

Copy link
Member

commented Oct 20, 2018

Have you tried modifying your AllowOverride settings as suggested?

@voss

This comment has been minimized.

Copy link
Author

commented Oct 20, 2018

@mapkyca I forgot to specify that on the shared hosting environment on Dreamhost, it's not possible to edit your apache2.conf file, so that's not an option. In order for you to do so, you need to get a DreamCompute instance, or pay for a dedicated server.

I don't believe it's possible to change the AllowOverride directive anywhere else but in the apache2.conf file.

@cdn

This comment has been minimized.

Copy link
Contributor

commented Oct 20, 2018

@mapkyca

This comment has been minimized.

Copy link
Member

commented Oct 20, 2018

I wonder whether rewrite is installed, but not necessarily enabled for your host.

If you're certain it is and you're convinced warmup is giving you an erroneous error you could try forcing the issue using the CLI installer: http://docs.withknown.com/en/latest/install/cliinstaller/

@voss

This comment has been minimized.

Copy link
Author

commented Oct 20, 2018

@cdn Hmm, No matter where I put the

AllowOverride All

directive int he .htaccess file, the site throws a 500 error.

I've tried putting it into the a Directory section, and also just putting it in the open, like I would normally do with

AllowOverride Indexes

for example.

Both result in HTTP 500 errors.

I suspect Dreamhost has done something to stop you from doing that.

Either way, it seems irrelevant since mod_rewrite seems to be working, as the vanilla .htaccess file works, including any new directives I've added to it, for example to always redirect http to https requests.

@cdn

This comment has been minimized.

Copy link
Contributor

commented Oct 20, 2018

@voss DreamHost probably have that capability locked down.

@mapkyca

This comment has been minimized.

Copy link
Member

commented Oct 20, 2018

iirc AllowOverride is verbotten in .htaccess, it has to be set in the central apache conf (for security reasons)

@benwerd

This comment has been minimized.

Copy link
Member

commented Oct 20, 2018

Do you get error logs with your DreamHost account? Are you able to see what shows up there when you get those 500 errors?

@voss

This comment has been minimized.

Copy link
Author

commented Oct 21, 2018

@benwerd when I place it as the first line in the .htaccess file, outside of any directives:

.htaccess: AllowOverride not allowed here

<Directory> type directives are not allowed in .htaccess files, so whenever I put that in there, it simply says:

htaccess: <Directory not allowed here.

So, as @mapkyca says, and as I mentioned earlier, you can not change AllowOverride in .htaccess. You can only set it in the apache2.conf file. On Dreamhost, you can not change your apache2.conf if you are on shared hosting (which I am).

So, to get back to the issue, either Dreamhost has a non-standard setup, where they are able to hide the fact that mod_rewrite is installed and enabled, or the test being done by Known in the warmup section, to test whether mod_rewrite is installed and enabled, is missing something.

I'll happily take a look at the CLI installer, thanks for that @mapkyca,

@cdn

This comment has been minimized.

Copy link
Contributor

commented Oct 22, 2018

NginX also suffers from the Rewrite test looping warmup due to some recent change(s) in master

@benwerd benwerd added this to To do in Known 1.0 Oct 25, 2018

@benwerd benwerd moved this from To do to High priority in Known 1.0 Oct 25, 2018

@benwerd

This comment has been minimized.

Copy link
Member

commented Oct 25, 2018

OTOH, DreamHost itself has a page about mod_rewrite. So I wonder if it's the detection rather than the implementation? https://help.dreamhost.com/hc/en-us/articles/215747748-How-can-I-redirect-and-rewrite-my-URLs-with-an-htaccess-file-

@funwhilelost

This comment has been minimized.

Copy link

commented Nov 8, 2018

@benwerd you're correct. Dreamhost defaults to a FastCGI implementation of PHP 7.0 at the moment. I have mine running fine there. Unfortunately that means that apache_get_modules() will not work correctly - nor is $_SERVER['HTTP_MOD_REWRITE'] set (which I think is just more of a convention).

I've had no problems running Known on Dreamhost but I just did the config by hand.

@mapkyca

This comment has been minimized.

Copy link
Member

commented Nov 8, 2018

The installer shouldn't be checking for apache_get_modules on nginx, so I don't think that's the issue.

The error shown above is less likely to be a false alarm, since it is trying to access the canary rewrite. Might be worth seeing if you can access that directly.

@mapkyca

This comment has been minimized.

Copy link
Member

commented Nov 19, 2018

Anecdotally, this appears to be a relatively new thing. Apparently the package on withknown.com does install, but newer packages don't. I guess this means I broke something when I rewrote the installer, although I can't for the life of me see what, or have any idea why it should only crop up on dreamhost.

@voss

This comment has been minimized.

Copy link
Author

commented Nov 19, 2018

@mapkyca if you need access to Dreamhost to test things out, I'll happily set up a user on my account for you, with ssh access. Just let me know.

@mapkyca

This comment has been minimized.

Copy link
Member

commented Nov 20, 2018

That'd be quite helpful, actually. You can email me on marcus@marcus-povey.co.uk, my pgp key should be on the standard key servers or my website.

@ejheil

This comment has been minimized.

Copy link
Contributor

commented Nov 20, 2018

OK, I had a chance to check out what's happening. In warmup/WebInstaller.php, on line 41, is:

    if (function_exists('apache_get_version')) {

I believe the function_exists call is returning false, so the rest of that if-clause isn't executed, and the function (with no explicit return) returns null.

Can't double check that is correct right now, I'll need to do so later today, but I think that's what's going on.

@cdn

This comment has been minimized.

Copy link
Contributor

commented Nov 20, 2018

@ejheil and for Nginx it will never exist :o)

@mapkyca

This comment has been minimized.

Copy link
Member

commented Nov 20, 2018

D'oh. Obviously.

Ok, I'll fix this shortly...

mapkyca added a commit to mapkyca/idno that referenced this issue Nov 20, 2018

Remove check for apache_get_version() in rewrite canary.
I am not sure why this was here, but it was causing the canary to skip and return null on nginx or similar, where rewrite was possible, but install would still fail.

Probably a cut and paste error on my part.

Closes idno#2238

Known 1.0 automation moved this from High priority to Done Nov 20, 2018

@voss

This comment has been minimized.

Copy link
Author

commented Nov 21, 2018

That'd be quite helpful, actually. You can email me on marcus@marcus-povey.co.uk, my pgp key should be on the standard key servers or my website.

I've added you on Keybase. Are you ok with using that for exchanging the info?

@PascalHeynmoeller

This comment has been minimized.

Copy link

commented Jan 19, 2019

I've installed latest version of known: version = "0.9.9-a" build = 2019011501 on Debian stable
with the same error discribed above.
CLIinstall worked but the wrong .htaccess was distributed!
Then I've copyed manualy .httaccess-2.4.dist and renamed it. Also changed all left .htaccess files inside into "Require all denied".
The Apache known site-conf has "<Directory /var/www/known/*> AllowOverride All" inside.
It seems like the Apache version info wasn't adequate for the Installer and the CLInstaller.
Now it stucks at https://blog.mydomain.tld/begin/ with "The requested URL /begin/ was not found on this server."
Maybe an bestpractice example apache2.4 site-conf could be provided in the documentation for better understanding of the requierements.
Thank you all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.