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

NGINX configuration #4

Closed
e8dev opened this issue Aug 11, 2021 · 3 comments
Closed

NGINX configuration #4

e8dev opened this issue Aug 11, 2021 · 3 comments

Comments

@e8dev
Copy link

e8dev commented Aug 11, 2021

Please share correct nginx configuration. Default Laravel / nginx / apache install give 404 Not Found error when trying to access https://mydomain.com/.well-known/acme-challenge/any8Token8Typed8Here.

If I'm creating Laravel route with "dot" before "well-know" as it requires lets encrypt:

Route::get('/.well-known/acme-challenge/{token}', function (string $token) { <<<=== it doesn't work

Removing dot makes routes reachable but it is not something what lets encrypt expects:

Route::get('/well-known/acme-challenge/{token}', function (string $token) { <<<=== it works

For some reason /.well-known/acme-challenge/{token} is not served by laravel application, nginx doesn't allow this route. (But for example allows next: "/.well-known/acme-challenge")

Approach no. 2:

If nginx settings are not available, please help to understand how to put / return token from default "/public/.well-known/acme-challenge/....." folder

In documentation I clearly see: "You can customise this behavior by setting a custom PathGenerator class in your config under path_generator', but no further explanation how to create custom PathGenerator class.

@e8dev e8dev closed this as completed Aug 11, 2021
@e8dev
Copy link
Author

e8dev commented Aug 11, 2021

It was ISP manager panel which overrides .well-known/acme-challenge/token route in 1) nginx and 2) apache .conf files
If somebody uses ISP manager - just clear configs: 1) /etc/nginx/vhosts-includes/letsencrypt.conf 2) /etc/apache2/conf.d/letsencrypt.conf

@Daanra
Copy link
Owner

Daanra commented Aug 13, 2021

Added a small note to the README that mentions this issue

@f5uii
Copy link

f5uii commented Aug 17, 2022

if you have DebugBar installed and enabled (.env with APP_DEBUG=true), the access at the token will return rubish that causes error 500. So add a simple \Debugbar::disable() in the route, before returning the token content.

Route::get('/.well-known/acme-challenge/{token}', function (string $token) {
\Debugbar::disable();
return Storage::get('public/.well-known/acme-challenge/' . $token);
\Debugbar::enable();
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants