配置Nginx反向代理Exchange 2007上的OWA
最后刚刚完成 Ex change 项目正式上线工作,考虑到一些用户的特殊要求,打算将 OWA 发布到公网,考虑到安全因素,不采用端口映射方式,另外也因为一些其它原因,没有采用微软建议方式,采用 ISA 发布。(网上资料很多,已有很多成熟的方案,如无成本等方面原
最后刚刚完成Exchange项目正式上线工作,考虑到一些用户的特殊要求,打算将OWA发布到公网,考虑到安全因素,不采用端口映射方式,另外也因为一些其它原因,没有采用微软建议方式,采用ISA发布。(网上资料很多,已有很多成熟的方案,如无成本等方面原因,建议采用,主要是方案很成熟,省事。^_^)
上面提了这么多要求,但是工作还得做,想了下,本质上就是让用户能在公网上能直接访问到OWA,但又不是直接访问到,所以想到这,就是加个中间人角色,让它帮忙把公网用户的要求传给内网服务器,说白了其实就是一反向代理。
应用反向代理的软件有很多,squid,nginx等等大大有名,因为nginx现在很流行,且此软件占用资源少,等优点,就在自己喜欢的gentoo上并应用了。
下面给出此代理的部分网络架构图,大家看了就明白了是怎么回事了。
下面就正式开始配置工作
Exchange Server Name: msg114.sunwill.cn
OWA Internat Name: outlook.sunwill.cn
一、系统及nginx安装 ~略,这个很简单的,大家都知道的
二、在Proxy上生成ssl证书,这一步很重要,当然,如果已经有申请到证书,就直接拷过来用就行,没必要用自生成的证书。
# mkdir /etc/nginx/ssl.crt
# mkdir /etc/nginx/ssl.key
Make sure to:
- Copy your certificate file to: /etc/nginx/ssl.crt/
- Copy your certificate key file to: /etc/nginx/ssl.key/
证书生成过程,大家可以在网查到,网上也有很多教程,只要生成了证书,放到上面两个目录中就行,nginx进行代理转发时用得到
三、就是配置OWA的反向代理了,配置文件如下所示
edward@jt-it001:~$vim /etc/nginx/conf.d/owa.conf
server {listen 80;
server_name outlook.sunwill.cn;
# Redirect any HTTP request to HTTPS
rewrite ^(.*) https://outlook.sunwill.cn$1 permanent;
error_log /var/log/nginx/outlook.sunwill.cn-owa-error.log;
access_log /var/log/nginx/outlook.sunwill.cn-owa-access.log;
}
server {
listen 443;
server_name outlook.sunwill.cn;
auth_basic "sunwill";
auth_basic_user_file nginx_passwd;
# Redirect from "/" to "/owa" by default
rewrite ^/$ https://outlook.sunwill.cn/owa permanent;
# Enable SSL
ssl on;
ssl_certificate /etc/nginx/ssl.crt/outlook.sunwill.cn.crt;
ssl_certificate_key /etc/nginx/ssl.key/outlook.sunwill.cn.key;
ssl_session_timeout 5m;
# Set global proxy settings
proxy_read_timeout 360;
proxy_pass_header Date;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location /owa { proxy_pass https://msg114.sunwill.cn/owa; }
location /exchange { proxy_pass https://msg114.sunwill.cn/exchange; }
location /exchweb { proxy_pass https://msg114.sunwill.cn/exchweb; }
location /public { proxy_pass https://msg114.sunwill.cn/public; }
location /Microsoft-Server-ActiveSync { proxy_pass https://msg114.sunwill.cn/Microsoft-Server-ActiveSync; }
error_log /var/log/nginx/outlook.sunwill.cn-owa-ssl-error.log;
access_log /var/log/nginx/outlook.sunwill.cn-owa-ssl-access.log;
}
最后一点,因为机器是放在DMZ中,所以有可能,其实也没必要让Proxy访问内网的DNS服务器,直接配置系统的/etc/hosts文件即可。让Proxy把资源反向代理到正确的服务器。
echo "192.168.103.200 msg114.sunwill.cn msg114" >> /etc/hosts
最后一些说明,
1.公网域名outlook.sunwill.cn指向到Proxy的公网地址
2.安全方面的一些考量,老生常谈了,服务器开启防火墙,只对外开户指定端口,服务器只运行需要的服务
3.自建证书是因为nginx有启用ssl,所以需要,可以直接用linux上自建的证书,此证书不一定要与exchange服务器上的证书一样,当然如果有申请正式的证书,肯定是用这个了
4.host记录一定要有,当然你愿意在DMZ区的防火墙上开户至内网的DNS查询,也可以,只是降低了相关安全性而已。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

How to configure an Nginx domain name on a cloud server: Create an A record pointing to the public IP address of the cloud server. Add virtual host blocks in the Nginx configuration file, specifying the listening port, domain name, and website root directory. Restart Nginx to apply the changes. Access the domain name test configuration. Other notes: Install the SSL certificate to enable HTTPS, ensure that the firewall allows port 80 traffic, and wait for DNS resolution to take effect.

The methods that can query the Nginx version are: use the nginx -v command; view the version directive in the nginx.conf file; open the Nginx error page and view the page title.

How to configure Nginx in Windows? Install Nginx and create a virtual host configuration. Modify the main configuration file and include the virtual host configuration. Start or reload Nginx. Test the configuration and view the website. Selectively enable SSL and configure SSL certificates. Selectively set the firewall to allow port 80 and 443 traffic.

Starting an Nginx server requires different steps according to different operating systems: Linux/Unix system: Install the Nginx package (for example, using apt-get or yum). Use systemctl to start an Nginx service (for example, sudo systemctl start nginx). Windows system: Download and install Windows binary files. Start Nginx using the nginx.exe executable (for example, nginx.exe -c conf\nginx.conf). No matter which operating system you use, you can access the server IP

Create a container in Docker: 1. Pull the image: docker pull [mirror name] 2. Create a container: docker run [Options] [mirror name] [Command] 3. Start the container: docker start [Container name]

How to confirm whether Nginx is started: 1. Use the command line: systemctl status nginx (Linux/Unix), netstat -ano | findstr 80 (Windows); 2. Check whether port 80 is open; 3. Check the Nginx startup message in the system log; 4. Use third-party tools, such as Nagios, Zabbix, and Icinga.

Docker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".
