1

Topic: How to combine settings iredmail and nginx?

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.4
- Linux/BSD distribution name and version: Ubuntu 15.10
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): Mysql
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro? no
- Related log if you're reporting an issue:
====

I need to get a workable web (done) and mail server (running, except for the Web interface)
On the net put ubuntu iredmail, I created a business address, and then transferred the configuration existing web server (nginx, php, mysql) - set up and it works, but it is impossible to combine settings for nginx c iredmail existing web server configuration.

iredmail put in /opt/www/iredadmin and /opt/www/roundcubemail necessary to make them accessible and domain.com/iredadmin domain.com/roundcube but I not succeed.

ln -s /opt/www/iredadmin/ /var/www/domain/iredadmin
ln -s /opt/www/roundcube/ /var/www/domain/roundcube
In nginx.conf - general settings and include

include /etc/nginx/conf.d/.conf;
include / etc / nginx / sites-enabled /;

fastcgi_cache_path /var/cache/nginx levels= keys_zone=wholepage:50m;

    server {
        listen       80;
        server_name  192.168.1.6 domain.com www.domain.com;
    access_log  /var/log/nginx/domain-access.log  main;
    error_log  /var/log/nginx/domain-error.log;
    server_name_in_redirect off;
#   rewrite ^([^.\?]*[^/])$ $1/ permanent;
    large_client_header_buffers 4 81920; #Fix for largest URI
    etag on;    
    expires 3d;
    if ($host ~ !^(domain.com|www.domain.com)$) {
            rewrite ^ http://www.domain.com$request_uri? permanent;  
}

location /static {
    root /data;
    expires max;
}   


       location / {
            root   /var/www/domain;
            index  index.php index.html index.htm;
            try_files $uri $uri/ /index.php?$args;
        proxy_read_timeout 600;

    location ~* ^/roundcube {
#        auth_basic "Admin Login";
#        auth_basic_user_file /etc/nginx/pass/roundcube_pass;
    fastcgi_pass   unix:/var/run/php-fpm.socket;
        include        /etc/nginx/fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }

        }
        # deny running scripts inside writable directories
        location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
                return 403;
                error_page 403 /403_error.html;
        }
    location ~ \.php$ {
            root  /var/www/domain;
#       if_modified_since off;
#       fastcgi_pass 127.0.0.1:9000;
        fastcgi_pass unix:/var/run/php-fpm.socket;  
            fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass_header Last-Modified;
        include fastcgi_params;
    } 

After access to http://domain.com/roundcube/ - in browser - error "File not found"

In /var/log/nginx/domain-error.log

*43490 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: .... , server: .... , req uest: "GET /roundcube/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.socket:", host: "domain.com"

Help please!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: How to combine settings iredmail and nginx?

Please check /etc/nginx/conf.d/default.conf, it contains "include ..." to support different web applications.