在Ubuntu 12.04上的Nginx中设置iRedMail管理站点 [英] Setup iRedMail Admin Site in Nginx on Ubuntu 12.04

查看:151
本文介绍了在Ubuntu 12.04上的Nginx中设置iRedMail管理站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难过要使它起作用,并且找不到任何可靠的答案,所以我想将解决方案发布到SO上,这样其他人可能会觉得有用.

I had a hell of a time getting this to work and couldn't find a solid answer anywhere so I figured I would post my solution to SO so others may find it useful.

我想在与MX服务器不同的虚拟盒子上运行我的所有SSL站点,而iRedMail默认情况下不是这样.使用nginx在新服务器上运行phpMyAdmin和roundcube很容易,这里不做介绍,要使admin面板使用uwsgi在nginx下运行并不是一件容易的事.

I wanted to run all of my SSL sites on a seperate virtual box from my MX server which by iRedMail default is not the case. Getting phpMyAdmin and roundcube going on the new server with nginx was easy and will not be covered here, what was not easy was getting the admin panel running under nginx with uwsgi.

最终结果是一台服务器仅用作邮件服务器,而另一台服务器运行nginx进行Web管理.

The end result of this is one server as the mail server only, and one server running nginx for web administration.

推荐答案

我从全新的Ubuntu 12.04.2 LTS安装开始,使用默认选项安装了2台服务器,仅在安装服务器以远程访问时添加了OpenSSL.一台服务器是邮件服务器,一台是SSL Web服务器.

I began with fresh Ubuntu 12.04.2 LTS installs, 2 servers setup with default options, only adding OpenSSL when installing the server to access remotely. One server is the mail server, one is the SSL web server.

在邮件服务器上,我下载了最新版本的iRedMail(截至本文发布时为0.8.4),并完成了安装过程以设置邮件服务器组件.我将mySQL用作后端,因此我选中了该选项,并输入了其余的域信息和密码,最后一页仅选中了DKIM,iRedAdmin和Fail2Ban.

On the mail server I downloaded the newest version of iRedMail (0.8.4 as of this post) and ran through the install to setup the mail server components. I use mySQL as my backend, so I checked that option, typed in the rest of my domain information and password, and on the last page only left DKIM, iRedAdmin, and Fail2Ban checked.

到Web Nginx SSL服务器上... 再次默认安装,仅添加OpenSSL.

Onto the web nginx SSL server... Again default install with only OpenSSL added.

以下是作为root用户运行的命令,用于安装运行管理面板所需的组件:

Here are the commands run as root to install the needed components for running the admin panel:

apt-get update
apt-get install nginx uwsgi uwsgi-plugin-python python-pip python-mysqldb
pip install jinja2
pip install web.py

然后我创建了要放置和设置iRedAdmin的位置

I then created the locations for where I wanted iRedAdmin to be placed and setup

mkdir /var/www/iredadmin
mkdir /var/www/iredadmin/static
mkdir /var/www/iredadmin/python-home

并将直接从邮件服务器安装的iredadmin复制并放置到新服务器的目录中.

and copied the iredadmin installed directly from the mail server and placed it into the new server's directory.

scp -r user@mail-server:/usr/share/apache2/iredadmin/* /var/www/iredadmin/

创建了位于以下位置的uwsgi应用程序配置ini文件:/etc/uwsgi/apps-available/iredadmin.ini

Created the uwsgi application config ini file located at: /etc/uwsgi/apps-available/iredadmin.ini

[uwsgi]
plugins=python
vhost=true
socket=/var/run/uwsgi/app/iredadmin/iredadmin.socket

创建软链接以启用应用程序:

Created the softlink to enable the application:

ln -s /etc/uwsgi/apps-available/iredadmin.ini /etc/uwsgi/apps-enabled/iredadmin.ini

为位于/etc/nginx/sites-available/iredadmin的nginx创建虚拟主机配置

Create the virtual host config for nginx located at: /etc/nginx/sites-available/iredadmin

server {
    listen 443 ssl; ## listen for ipv4; this line is default and implied
    access_log /var/log/nginx/iredadmin.access.log;
    error_log /var/log/nginx/iredadmin.error.log;

   ssl_certificate /etc/nginx/ssl/star.crt;
   ssl_certificate_key /etc/nginx/ssl/server.key;
   ssl_session_timeout 5m;
   ssl_protocols SSLv3 TLSv1;
   ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
   ssl_prefer_server_ciphers on;

    server_name iredadmin.server.com;

    location / {
    root /var/www/iredadmin/;
    uwsgi_pass unix:///var/run/uwsgi/app/iredadmin/iredadmin.socket;
    uwsgi_param UWSGI_PYHOME /var/www/iredadmin/python-home;
    uwsgi_param UWSGI_CHDIR /var/www/iredadmin;
    uwsgi_param UWSGI_SCRIPT iredadmin;
    include uwsgi_params;
    }

    location /static {
    alias /var/www/iredadmin/static/;
        }

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

并创建了一个软链接以使该站点启用nginx:

and created a softlink to enable the site for nginx:

ln -s /etc/nginx/sites-available/iredadmin /etc/nginx/sites-enabled/iredadmin

最后,重新启动服务并从浏览器访问服务器名称:

Finally, restart the services and head to your server name from your browser:

/etc/init.d/uwsgi restart
/etc/init.d/nginx restart

这篇关于在Ubuntu 12.04上的Nginx中设置iRedMail管理站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆