Niltze all-
After much experimentation and frustration at coming up with a base configuration for b2evolution 6.10.7 on Nginx, I came up with the subsequent resource.
I used that as a base for a migration away from my own build of Apache 2.4.29 to my own build of nginx 1.15.9 and subsequently 1.15.11. Along the way, I enhanced the configuration with SSL certificates for a couple of sites, i.e.,
Server Name Indication
A more generic solution for running several HTTPS servers on a single IP address is TLS Server Name Indication extension (SNI, RFC 6066), which allows a browser
to pass a requested server name during the SSL handshake and, therefore, the server will know which certificate it should use for the connection. SNI is currently
supported by most modern browsers, though may not be used by some old or special clients.
https://nginx.org/en/docs/http/configuring_https_servers.html
Apropos I made a pull request at https://github.com/nginxinc/nginx-wiki/pull/440 hoping others will benefit, as well.
server {
listen 80;
server_name b2evolution.blog www.b2evolution.blog;
root /var/www/b2evolution;
index index.php index.htm index.html;
location / {
index index.php;
try_files $uri $uri/ @b2evo;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
try_files $uri /htsrv/getfile.php?$args;
expires max;
log_not_found off;
}
location @b2evo {
rewrite ^(.*) /index.php?$1 last;
}
location /api/ {
auth_basic off;
rewrite "^/api/v(?<version>[^/]+)/(?<parameters>(.+))$" /htsrv/rest.php?api_version=$version&api_request=$parameters last;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
P.S. My main interest in building nginx was to integrate the newly released ModSecurity v3 Nginx Connector module. After bragging...er, blogging, about how I built it, I made nginx 1.15.9 available for others to download. And then I realized I had to 'eat my own cooking'.
As I have time I will make nginx 1.15.11 available as well --possibly in a subsequent blog entry.
Big thanks to @DM as I took a couple of directives from his post to complete b2evolution essential functionality.
https://forums.b2evolution.net/nginx-config#c111512
Fixed reStructuredText (.rst) formatting error that was failing b2evolution base configuration for Nginx pull test request:
"All checks have passed"
https://github.com/nginxinc/nginx-wiki/pull/440
...specifically
https://github.com/Metztli/nginx-wiki/blob/master/source/start/topics/recipes/b2evolution.rst