iredmail邮件服务器之修改默认的web服务端口号
安裝iredmail之后,由于需要在路由器上做端口映射以便在外網(wǎng)訪問(wèn)webmail,因此端口不能和WEB服務(wù)的端口好沖突,所以需要修改郵件服務(wù)器的httpd服務(wù)的端口。
一、apache/httpd的http服務(wù)和https服務(wù)端口號(hào)都要修改。
基本服務(wù)端口好辦,iredmail默認(rèn)安裝下,修改/etc/httpd/conf/httpd.conf中的Listen一行即可,這里我改為8090
#Listen 80 Listen 8090可是,roundcube的webmail服務(wù)都是使用的https服務(wù),我們都知道https的默認(rèn)端口是443,這個(gè)在哪里修改呢?后來(lái)找到這篇文章修改apache http/https 端口號(hào),卻發(fā)現(xiàn)我的/etc/httpd/conf目錄下沒(méi)extra子目錄,更別提那個(gè)httpd-ssl.conf!我估計(jì)可能版本不同,經(jīng)過(guò)一番搜索,找到/etc/conf.d/ssl.conf,估計(jì)就是他了,這里修改443為8093。
#Listen 443 Listen 8093.
.
.
##
## SSL Virtual Host Context
##
#<VirtualHost _default_:443>
<VirtualHost _default_:8093>
? 修改保存后,重新啟動(dòng)httpd服務(wù)
[root@mail2 ~]# service httpd restart二、添加iptables防火墻規(guī)則,開(kāi)放新的端口號(hào)
這個(gè)沒(méi)啥可說(shuō)的,新建兩條規(guī)則,開(kāi)放新修改的端口,注意保存就行。
[root@mail2 ~]# iptables -A INPUT -p tcp -m tcp --dport 8090 -j ACCEPT [root@mail2 ~]# iptables -A INPUT -p tcp -m tcp --dport 8093 -j ACCEPT [root@mail2 ~]# service iptables save三、修改roundcube的配置文件和小bug
此時(shí)如果直接用https端口去訪問(wèn)webmail已經(jīng)可以了,但是如果使用http方式訪問(wèn),然后由roundcube實(shí)現(xiàn)https強(qiáng)制跳轉(zhuǎn),則roundcube形成的還是默認(rèn)的https端口地址形式,所以訪問(wèn)失敗。比如,我現(xiàn)在的http地址為
http://192.168.5.26:8090/mail
則roundcube自動(dòng)跳轉(zhuǎn)為
https://192.168.5.26/mail
此時(shí)需要修改roundcube的配置文件,在我的版本中為/var/www/roundcubemail/config/config.inc.php(新版本是這個(gè)文件,而不是網(wǎng)上所說(shuō)的舊版文件main.inc.php)
$config['force_https'] = true;將上面這行修改為:
$config['force_https'] = 8093;另外,還要修改index.php中的一個(gè)小bug(可能是,我用chrome瀏覽時(shí)報(bào)錯(cuò)說(shuō)本頁(yè)有循環(huán)跳轉(zhuǎn)代碼)
代開(kāi)/var/www/roundcubemail/index.php文件,找到下面這行
// check if https is required (for login) and redirect if necessary if (empty($_SESSION['user_id']) && ($force_https = $RCMAIL->config->get('force_https', false))) {修改為下面這行(就是加了一個(gè)判斷,當(dāng)前地址是否處于https模式)
// check if https is required (for login) and redirect if necessary if ($_SERVER["HTTPS"]<>"on" && empty($_SESSION['user_id']) && ($force_https = $RCMAIL->config->get('force_https', false))) {四、沒(méi)有第四,打完收工:)
最后,別忘了重起一下服務(wù)
[root@mail2 roundcubemail]# apachectl restart?
總結(jié)
以上是生活随笔為你收集整理的iredmail邮件服务器之修改默认的web服务端口号的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 创建动画
- 下一篇: Tomcat 6.0 简介