Remove the need for PHP for Apache2, thank you https://serverfault.com/a/938323/336084
parent
b5bec6c471
commit
082bd5bcb3
|
@ -40,37 +40,25 @@ Configure your webserver to respond statelessly to challenges for a given accoun
|
|||
respond @achallenge "{re.ch.1}.6fXAG9VyG0IahirPEU2ZerUtItW2DHzDzD9wZaEKpqd"
|
||||
```
|
||||
### APACHE
|
||||
|
||||
_Tested on Apache 2.4.61_
|
||||
|
||||
Add something similar to your `httpd.conf`:
|
||||
```apache
|
||||
LoadModule php7_module libexec/apache2/libphp7.so
|
||||
...
|
||||
<VirtualHost *:80>
|
||||
...
|
||||
<IfModule php7_module>
|
||||
AddType application/x-httpd-php .php
|
||||
AddType application/x-httpd-php-source .phps
|
||||
<IfModule dir_module>
|
||||
DirectoryIndex index.html index.php
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
...
|
||||
<Directory "/PATH/TO/WWW/ROOT/.well-known/acme-challenge/">
|
||||
RewriteEngine On
|
||||
RewriteRule "^[-_a-zA-Z0-9]+$" "index.php"
|
||||
RewriteRule "^([-_a-zA-Z0-9]+)$" "$1" [E=challenge:$1]
|
||||
ErrorDocument 200 "%{ENV:challenge}.6fXAG9VyG0IahirPEU2ZerUtItW2DHzDzD9wZaEKpqd"
|
||||
RewriteRule ^ - [L,R=200]
|
||||
</Directory>
|
||||
...
|
||||
</VirtualHost>
|
||||
...
|
||||
```
|
||||
Then add `/PATH/TO/WWW/ROOT/.well-known/acme-challenge/index.php`:
|
||||
```php
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
$token = array_pop(explode('/',$_SERVER['REQUEST_URI']));
|
||||
echo "$token.6fXAG9VyG0IahirPEU2ZerUtItW2DHzDzD9wZaEKpqd";
|
||||
?>
|
||||
```
|
||||
_NOTE that this approach uses PHP but something similar could be done with CGI, Perl, Ruby or pretty much any other server-side language._
|
||||
|
||||
### HAPROXY
|
||||
Add the http-request return rule to your configuration:
|
||||
```haproxy
|
||||
|
|
Loading…
Reference in New Issue