tests - increase timeout when doing requests

This commit is contained in:
bunkerity 2022-07-26 15:42:56 +02:00
parent b076370090
commit c67564c7c8
No known key found for this signature in database
GPG Key ID: 3D80806F12602A7C
2 changed files with 36 additions and 104 deletions

View File

@ -1799,61 +1799,44 @@ BunkerWeb supports PHP using external or remote [PHP-FPM](https://www.php.net/ma
We will assume that you already have the [Linux integration](/1.4/integrations/#linux) stack running on your machine.
Configuration of BunkerWeb is done by editing your local `variables.env` file :
By default, BunkerWeb will search for web files inside the `/opt/bunkerweb/www` folder. We recommend you to use it for storing your PHP application. Please note that you will need to configure your PHP-FPM service to make it search for PHP files inside the `/opt/bunkerweb/www` folder. Communication with the PHP-FPM service will be done using UNIX socket file.
Depanding of your system, you may need to change `LOCAL_PHP_PATH`.
First of all, you will need to make sure that your PHP-FPM instance can access the files inside the `/opt/bunkerweb/www` folder and also that BunkerWeb can access the UNIX socket file in order to communicate with PHP-FPM. We recommend to set a different user like `www-data` for the PHP-FPM service and to give the nginx group access to the UNIX socket file. Here is corresponding PHP-FPM configuration :
```ini
[www]
user = www-data
group = www-data
listen = /run/php/php-fpm.sock
listen.ower = www-data
listen.group = nginx
listen.mode = 0660
```
=== "Ubuntu"
```conf
SERVER_NAME=www.example.com
HTTP_PORT=80
HTTPS_PORT=443
DNS_RESOLVERS=8.8.8.8 8.8.4.4
DISABLE_DEFAULT_SERVER=no
USE_CLIENT_CACHE=yes
USE_GZIP=yes
LOCAL_PHP=/run/php/php-fpm.sock
LOCAL_PHP_PATH=/opt/bunkerweb/www/
```
Don't forget to reload/restart your PHP-FPM service :
```shell
systemctl restart php-fpm
```
=== "Debian"
```conf
SERVER_NAME=www.example.com
HTTP_PORT=80
HTTPS_PORT=443
DNS_RESOLVERS=8.8.8.8 8.8.4.4
DISABLE_DEFAULT_SERVER=no
USE_CLIENT_CACHE=yes
USE_GZIP=yes
LOCAL_PHP=/run/php/php-fpm.sock
LOCAL_PHP_PATH=/opt/bunkerweb/www/
```
Once your application is copied to the `/opt/bunkerweb/www` folder, you will need to fix the permissions so BunkerWeb (user/group nginx) can at least read files and list folders and PHP-FPM (user/group www-data) is the owner of the files and folders :
```shell
chown -R www-data:nginx /opt/bunkerweb/www && \
find /opt/bunkerweb/www -type f -exec chmod 0640 {} \; && \
find /opt/bunkerweb/www -type d -exec chmod 0750 {} \;
```
=== "CentOs"
```conf
SERVER_NAME=www.example.com
HTTP_PORT=80
HTTPS_PORT=443
DNS_RESOLVERS=8.8.8.8 8.8.4.4
DISABLE_DEFAULT_SERVER=no
USE_CLIENT_CACHE=yes
USE_GZIP=yes
LOCAL_PHP=/run/php-fpm/www.sock
LOCAL_PHP_PATH=/opt/bunkerweb/www/
```
=== "Fedora"
```conf
SERVER_NAME=www.example.com
HTTP_PORT=80
HTTPS_PORT=443
DNS_RESOLVERS=8.8.8.8 8.8.4.4
DISABLE_DEFAULT_SERVER=no
USE_CLIENT_CACHE=yes
USE_GZIP=yes
LOCAL_PHP=/run/php-fpm/www.sock
LOCAL_PHP_PATH=/opt/bunkerweb/www/
```
You can now edit the `/opt/bunkerweb/variable.env` file :
```env
HTTP_PORT=80
HTTPS_PORT=443
DNS_RESOLVERS=8.8.8.8 8.8.4.4
DISABLE_DEFAULT_SERVER=yes
SERVER_NAME=www.example.com
AUTO_LETS_ENCRYPT=yes
USE_CLIENT_CACHE=yes
USE_GZIP=yes
LOCAL_PHP=/run/php/php-fpm.sock
LOCAL_PHP_PATH=/opt/bunkerweb/www/
```
Let's check the status of BunkerWeb :
```shell
@ -1864,57 +1847,6 @@ BunkerWeb supports PHP using external or remote [PHP-FPM](https://www.php.net/ma
systemctl reload bunkerweb
```
Then you will have to install php-fpm
```shell
apt install php-fpm
```
Depending on your system, the configuration of the php-fpm service may change:
=== "Ubuntu"
By default, the user and the group of the php-fpm service is "www-data", so change it to your user.
```conf
[www]
user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx
```
=== "Debian"
By default, the user and the group of the php-fpm service is "www-data", so change it to your user.
```conf
[www]
user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx
```
=== "CentOs"
By default, the user and the group of the php-fpm service is "apache", so change it to your user.
```conf
[www]
user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx
```
=== "Fedora"
By default, the user and the group of the php-fpm service is "apache", so change it to your user.
```conf
[www]
user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx
```
Reload the php-fpm service :
```shell
systemctl reload php-fpm
```
=== "Ansible"
You will need to add the settings to your `variables.env` file accordingly to your system :

View File

@ -101,10 +101,10 @@ class Test(ABC) :
ex_url = sub(ex_domain, test_domain, ex_url)
break
if test["type"] == "string" :
r = get(ex_url, timeout=5)
r = get(ex_url, timeout=10)
return test["string"].casefold() in r.text.casefold()
elif test["type"] == "status" :
r = get(ex_url, timeout=5)
r = get(ex_url, timeout=10)
return test["status"] == r.status_code
except :
#log("TEST", "❌", "exception while running test of type " + test["type"] + " on URL " + ex_url + "\n" + format_exc())