Author Topic: NGINX SETTING  (Read 27617 times)

0 Members and 1 Guest are viewing this topic.

skybranks

  • Jr. Member
  • **
  • Posts: 1
NGINX SETTING
« on: January 12, 2017, 03:12:47 AM »
I have successfully set up Mibew on Apache, but I am now trying to set up mibew-2.2.0 on nginx.

For Nginx I'm a novice.

I cannot get the install to run, and I get an error:404

I try to convert .htaccess contents ,but it doesn't work.

if i convert .htaccess,need to remove .htaccess in mibew?

I hope get some suggestions.

project path:/var/www/mibew

server{}:
server {
    listen       80;
    server_name  localhost;
    root   /var/www;
    index  index.php  index.html;

    location / {

     if (!-f $request_filename){
        set $rule_0 1$rule_0;
     }
     if (!-d $request_filename){
        set $rule_0 2$rule_0;
     }
     if ($rule_0 = "21"){
        rewrite ^/install(/(.*))?$ /install.php last;
     }

    if (!-f $request_filename){
        set $rule_0 1$rule_0;
     }
    if (!-d $request_filename){
        set $rule_0 2$rule_0;
    }
    if ($rule_0 = "21"){
        rewrite ^/(.*)$ /index.php last;
    }

       
    }

 
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    location ~ \.php$ {
        if (!-f $request_filename){
          set $rule_0 1$rule_0;
        }
       if (!-d $request_filename){
         set $rule_0 2$rule_0;
       }
      if ($rule_0 = "21"){
         rewrite ^/install(/(.*))?$ /install.php last;
      }

      if (!-f $request_filename){
        set $rule_0 1$rule_0;
      }
     if (!-d $request_filename){
        set $rule_0 2$rule_0;
     }
     if ($rule_0 = "21"){
        rewrite ^/(.*)$ /index.php last;
    }

        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }
}
             


can anyone show the nginx.conf  :server{}?


scalior

  • Global Moderator
  • Native
  • *****
  • Posts: 106
  • Serve customers on mobile. Get Wurrd for Mibew app
    • Wurrd for Mibew
Re: NGINX SETTING
« Reply #1 on: January 13, 2017, 08:59:41 AM »
My understanding is that Mibew is not officially tested with nginx. However, if you can successfully translate the .htaccess file then you shouldn't have a problem. Unfortunately I don't have any nginx experience. Hopefully you can find help here or just by searching around on Google.

faf

  • Mibew Staff Member
  • Native
  • *****
  • Posts: 951
    • Mibew Messenger
Re: NGINX SETTING
« Reply #2 on: January 17, 2017, 12:32:52 PM »
@scalior, You're right.

Briefly:

1. Mibew works fine on Apache as a backend when nginx acts as a frontend proxy if they are installed on different (virtual) servers.

2. There are a number of known unresolved issues (for example, #187) if nginx and Apache works together on the same server.

3. And we've never tried Mibew Messenger to run in the FastCGI mode with nginx acting as a frontend. But there was a similar question on the forum: https://mibew.org/forums/index.php/topic,191896.msg198829.html

w4u

  • Jr. Member
  • **
  • Posts: 2
    • -:: Web For You ::-
Re: NGINX SETTING
« Reply #3 on: February 04, 2017, 03:45:30 PM »
Code: [Select]
server {
        listen *:80;

        server_name xxx.w4u.fr ;

        root   /var/www/path/web/;

        index index.php index.html;

        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }

        location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
        }

        location ~ \.php$ {
            try_files /a63e8f4661b83e618f48a1ecc1b4116b.htm @php;
        }

        location @php {
            try_files $uri =404;
            include /etc/nginx/fastcgi_params;
            fastcgi_param HTTP_PROXY "";
            fastcgi_pass unix:/var/lib/php7-fpm/web.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_intercept_errors on;
        }

        location / {
            rewrite ^/$ /index.php permanent;
            rewrite ^/install\.php/(.*)$ /install.php?$1 last;
            rewrite ^/index\.php/(.*)$ /index.php?$1 last;
        }

        location ~ \.(yml|po|ini|handlebars|keep)$ {
deny all;
        }
       
        location /cron.php {
deny all;
        }

location ~ /\.ht {
deny  all;
}

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
                root   /usr/share/nginx/html;
        }
}
« Last Edit: November 24, 2017, 01:20:20 PM by w4u »