我的邮件服务器上安装了 2 个 Web 服务。
- Roundcube /var/www/roundcube
- 邮件管理工具 /var/www/mailAdmin (用于 postfix、dovecot 配置)
此外,邮件服务器的 Apache2 隐藏在 nginx 反向代理后面。
我的问题是,如何配置 Apache 来映射所有http://mail.example.org/请求到我的/var/www/roundcube
文件夹和所有http://mail.example.org/mailadmin文件夹的请求/var/www/mailAdmin
。
我写了以下配置。但问题是每个请求都映射到/var/www/roundcube
,如果我请求http://mail.example.org/webadminApache 尝试访问/var/www/roundcube/mailadmin
。
我现在可以做一个ln -s
但感觉不对,不是吗?
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName example.org
ServerAlias mail.example.org
DocumentRoot /var/www/roundcube/
<Directory />
Options FollowSymLinks
AllowOverride Nonedevcontrol
</Directory>
<Directory /var/www/roundcube>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
配置反向代理是:
server{
listen 80;
server_name mail.exampole.org;
rewrite ^ https://mail.example.org$request_uri? permanent;
}
server {
listen 443;
server_name mail.example.org;
access_log /var/log/nginx/access.mail.log;
error_log /var/log/nginx/error.mail.log;
###SSL###
include w.example.org.conf;
# proxy to Apache 2 and mod_python
location / {
proxy_pass http://192.168.1.200:80/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_max_temp_file_size 0;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}