Recent Topics

nginx config

Started by on Feb 02, 2016 – Contents updated: Jul 08, 2017

Feb 02, 2016 12:42    

Hello all!

Can anyone share actual config for Nginx for b2evolution?

I wrote this but I can't write a rule for global.php (wrapper for images?)
My current config:

server {

listen  80;
server_name   tt ;

gzip on; 
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;

access_log    /var/tt/logs/nginx/access.log   main;
error_log     /var/tt/logs/nginx/error.log;

server_tokens off;
add_header    X-Frame-Options "SAMEORIGIN";

location /      {
                root /var/tt/www/;
                index index.htm index.html index.php;
                if (!-e $request_filename) {
                        rewrite ^(.+)$ /index.php?$request_uri last;

location ~ \.php$ {
                root /var/tt/www;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME /var/tt/www$fastcgi_script_name;
                include fastcgi_params;

Thank you! :)

Feb 04, 2016 01:21

What do you mean with

I wrote this but I can't write a rule for global.php (wrapper for images?)

which part of .htaccess are you having trouble with?

Jul 08, 2017 00:59

I recently changed my server to Nginx from apahce. I got rewrites to work using:
rewrite ^/api/v(d+)/(.+)$ /htsrv/rest.php?api_version=$1&api_request=$2 last;
if (!-d $request_filename){
set $rule_1 1$rule_1;
if (!-f $request_filename){
set $rule_1 2$rule_1;
if ($rule_1 = "21"){
rewrite ^/[^.]+(.(html|htm))?$ /index.php last;

but I don't know if that's the best way.

The images that get linked through htsrv give a not found:
but in the back office this works:

Form is loading...

powered by b2evolution – This forum is powered by b2evolution CMS, a complete engine for your website.