Nginx Atmail 404 errot

how do i configure ATMAIL to work with nginx?

I want to configure like this www.domain.com/atmail

But it is not working i keep on getting a 404 error.

I know it is a config with rewrite, the thing is i’m running wordpress, and i got this rules to make the correct rewrite:

   location / {  
            try_files $uri $uri/ /index.php?$args;  
   }  

   # Add trailing slash to */wp-admin requests.  
   rewrite /wp-admin$ $scheme://$host$uri/ permanent;  

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

When i specify this way it works. but it loads atmail at the root domain.

location / {  
# Path to your Atmail webmail directory  
    root    /var/www/alloweb.net.br/web;   
    index  index.php;  

    # this serves static files that exist without running other rewrite tests  
    if (-f $request_filename) {  
        expires 30d;  
        break;  
    }  

# Routes directory requests to index.php.  
    if (!-e $request_filename) {  
        rewrite ^(.+)$ /index.php?q=$1 last;  
    }  


}  

location ~ \.php$ {  
    fastcgi_pass   127.0.0.1:9018;  # IP and Port of your spawn-fcgi process   
    fastcgi_index  index.php;  
    fastcgi_param  SCRIPT_FILENAME     $document_root$fastcgi_script_name;   

    fastcgi_param  QUERY_STRING       $query_string;  
    fastcgi_param  REQUEST_METHOD     $request_method;  
    fastcgi_param  CONTENT_TYPE       $content_type;  
    fastcgi_param  CONTENT_LENGTH     $content_length;  
    fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;  
    fastcgi_param  REQUEST_URI        $request_uri;  
    fastcgi_param  DOCUMENT_URI       $document_uri;  
    fastcgi_param  DOCUMENT_ROOT      $document_root;  
    fastcgi_param  SERVER_PROTOCOL    $server_protocol;  
    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;  
    fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;  
    fastcgi_param  REMOTE_ADDR        $remote_addr;  
    fastcgi_param  REMOTE_PORT        $remote_port;  
    fastcgi_param  SERVER_ADDR        $server_addr;  
    fastcgi_param  SERVER_PORT        $server_port;  
    fastcgi_param  SERVER_NAME        $server_name;  
    fastcgi_param  REDIRECT_STATUS    200;  
}  

Can someone help?

my host is ubuntu with ispconfig3, nginx and wordpress

Looks like your question is not related to our tutorials - http://rtcamp.com/tutorials/ and conventions - http://rtcamp.com/wordpress-nginx/tutorials/conventions/

Sorry but we cannot provide support for ISPConfig or atmail.

Our mail setup can be found here - http://rtcamp.com/tutorials/mail/server/

For sites-management, we use http://rtcamp.com/easyengine

By the way, atmail looks like a PRO thing. So it’s developer might be able to help you.