Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have configuration for iRedMail:

server
{
    listen 80;
    server_name mail.myserver.com;
    rewrite     ^(.*)   https://$server_name$request_uri?   permanent;
}

server
{
    # By default we listen on all ips including ipv6 on port 443.  We only respond to the server name here.
    # If you have a default ssl website already comment out the next line and uncomment the one after..
    listen 443 ssl;
    #listen 443 ssl;
    server_name mail.myserver.com;

    # Our logs files.
    access_log  /var/log/nginx/iredmail-access.log;
    error_log   /var/log/nginx/iredmail-error.log;

    # Startup SSL using iRedMails certs.
    # If you made the ssl change above you will need to make this one to enable ssl.
    # ssl on;
    ssl_certificate     /etc/ssl/certs/iRedMail_CA.pem;
    ssl_certificate_key /etc/ssl/private/iRedMail.key;
    ssl_session_timeout 5m;

    # We specify our root location to roundcubemail.
    root    /usr/share/apache2/roundcubemail/;
    index   index.html index.php;

    # Aliasing some locations of static files.
    location /iredadmin/static  { alias /usr/share/apache2/iredadmin/static/;}
    location /static        { alias /usr/share/apache2/iredadmin/static/;}
    location /awstats/icon      { alias /usr/share/awstats/icon/;}
    location /awstatsicon       { alias /usr/share/awstats/icon/;}

    # This allows webmail and roundcube as aliases to /mail/. The root is redirected to /mail.
        rewrite ^/roundcubemail /mail/  permanent;
        rewrite ^/webmail   /mail/  permanent;
        rewrite ^/$     /mail/  permanent;

    # This doesn't work yet, but maybe someday will be able to run the admin service.
#   location /iredadmin
#   {
#       rewrite         ^/intenral/(.*) /$1 break;
#       proxy_set_header    Host        $host;
#       proxy_set_header    X-Real-IP   $remote_addr;
#       proxy_pass      http://127.0.0.1:9000/;
#   }

    # This is used to create a comparision to Apaches ability to alias that works with dynamic scripts.
    location ~ /mail(.*)\.php($|/)
    {
        include     fastcgi_params;
        fastcgi_pass    unix:/var/run/fpm-iredmail.sock;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME /usr/share/apache2/roundcubemail$1.php;
        fastcgi_param   SERVER_NAME $http_host;
        fastcgi_ignore_client_abort on;
        fastcgi_intercept_errors    off;
    }
    location ~/mail(.*)
    {
        autoindex   on;
        alias       /usr/share/apache2/roundcubemail$1;
    }

    # Our phpMyAdmin service.  Comment this section out if you don't want public access to it.
    location ~ /phpmyadmin(.*)\.php($|/)
    {
        include     fastcgi_params;
        fastcgi_pass    unix:/var/run/fpm-iredmail.sock;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME /usr/share/phpmyadmin$1.php;
        fastcgi_param   SERVER_NAME $http_host;
        fastcgi_param   HTTPS       on;
        fastcgi_param   HTTP_SCHEME https;
        fastcgi_ignore_client_abort on;
        fastcgi_intercept_errors    off;
        port_in_redirect        off;
    }
    location ~/phpmyadmin(.*)
    {
        autoindex   on;
        alias       /usr/share/phpmyadmin$1;
    }
}

but get the 502 bad gateway error and the following error in /var/log/nginx/iredmail-error.log

2013/07/30 06:11:08 [error] 9253#0: *2 open() "/usr/share/apache2/roundcubemail/favicon.ico" failed (2: No such file or directory), client: x.x.x.x, server: mail.myserver.com, request: "GET /favicon.ico HTTP/1.1", host: "mail.myserver.com"

How to configure the nginx/iredmail? I want have iredmail and one another service on the same machine

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.