- b2evolution CMS Support Forums
- b2evolution Support
- General Support
- Engine X, aka Nginx, updated barebones config file for b2evolution
1 nanahuatl Mar 04, 2021 12:54
This file works in a localhost to test b2evolution and supersedes the previous file posted elsewhere. Note that it assumes your have PHP 7.4 FPM (see relevant line in configuration) and that you replace servername; (again, locate relevant line below) with whatever your localhost is assigned.
server {
## listen :443;
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/b2evolution;
index index.php index.html index.htm;
## server_name domain.tld;
server_name _;
etag on;
client_max_body_size 128M;
location ~* /htsrv/getfile.php/(.*)$
{
try_files $uri /htsrv/getfile.php?$args;
}
location ~* \.(png|jpg|ico|cur|gif|pdf|zip|jpeg|ttf|eot|woff)$
{
aio threads;
gzip on;
gzip_static off;
add_header Cache-Control "max-age: 86640";
access_log off;
log_not_found off;
etag on;
}
location ~* \.(js|map|html|css|json|htm|xml|txt)$
{
aio threads;
add_header Cache-Control "max-age: 86640";
access_log off;
log_not_found off;
etag on;
}
location /api/
{
auth_basic off;
rewrite "^/api/v(?<version>[^/]+)/(?<parameters>(.+))$" /htsrv/rest.php?api_version=$version&api_request=$parameters last;
}
location /go/
{
rewrite "^/go/(?<key>(.+))$" /htsrv/track.php?key=$key last;
}
if ( $http_user_agent ~* (nmap|nikto|wikto|sf|sqlmap|bsqlbf|w3af|acunetix|havij|appscan) ) { return 403; }
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffers 8 128k;
fastcgi_buffer_size 256k;
fastcgi_read_timeout 3000;
fastcgi_keep_conn on;
fastcgi_index index.php;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
location ~ /\. { deny all; internal;}
location ~ /\.svn|/\.git { deny all; internal; }
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location ~ /.well-known {allow all;}
}
Note that b2evolution on Nginx will not get its time zone (during installation) and/or memory from the values in
/etc/php/7.4/fpm/php.ini
but rather b2evolution on Nginx will obtain those values from
/var/www/b2evolution/conf/_advanced.php
i.e.,
$date_default_timezone = 'Mexico/Tenochtitlan';
and/or
// @ini_set( 'memory_limit', '128M' );
@ini_set( 'memory_limit', '256M' );
I used a similar local B2evo/Nginx installation to produce the previous post screenshots.
@nanahuatl wrote earlier:
It was done, specifically, in VirtualBox -- a type 2 hypervisor that can be built and run under GNU / Linux distributions, as well as the alternative proprietary operating systems which brand names start with a 'W' and a 'M', respectively -- hosting a 'guest' Debian Buster backports AMD64 image with backported Nginx 1.19.6 Debian packages.