Apache 2 different port no for different website

时间:2017-04-10 02:57:47

标签: ubuntu dns apache2 port

I have installed the ISPConfig in my ubuntu 16. In my existing apache 2, I have already had a website called example.com which is listening to port 80. For ISPConfig (domain will be https://www.example.com:8088), I plan to use port 8088. I tried to update the example-ssl.conf file to support that.

However, when I access the https://www.example.com:8088, it will redirect to https://www.example.com

I would like to ask if there is any problem with my config as I really cannot find out the problem.

Thank you for your help.

example-ssl.conf

Listen 80
Listen 8088

<IfModule mod_ssl.c>
        <VirtualHost *:443>
                ServerAdmin webmaster@localhost
                ServerName example.com
                ServerAlias www.example.com
                DocumentRoot /var/www/html

                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined


                #Include conf-available/serve-cgi-bin.conf

                #   SSL Engine Switch:
                #   Enable/Disable SSL for this virtual host.
                SSLEngine on


                SSLCertificateFile      /etc/ssl/mysite-selfsigned.crt
                SSLCertificateKeyFile /etc/ssl/mysite-selfsigned.key


                #SSLCACertificatePath /etc/ssl/certs/
                #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt


                #SSLCARevocationPath /etc/apache2/ssl.crl/
                #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl


                #SSLVerifyClient require
                #SSLVerifyDepth  10


                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>
                BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0

        </VirtualHost>

</IfModule>

example.com-8088.conf

Listen 8088
<VirtualHost *:8088>
        ServerName example.com:8088
        ServerAlias www.example.com:8088
        DocumentRoot /usr/local/ispconfig/interface/web
</VirtualHost>

2 个答案:

答案 0 :(得分:0)

当您输入“ http:// ”时,您的浏览器会将其解释为使用端口80 来查找下一个显示的地址。 当您输入“ https:// ”时,您的浏览器会将其解释为使用端口443 ...“。

因此,当您的客户使用“https:// ....”访问您的网站时,他们将尝试通过443端口访问您的网站。

因此,只要您的外部防火墙能够正确转发端口443传入流量到服务器正在使用的任何备用端口,并以客户浏览器理解的方式发回其响应,会没事的。

答案 1 :(得分:0)

/etc/apache2/ports.conf中的端口添加为

Listen 8088

如果您尚未完成,请使用

启用您的网站
sudo a2ensite example.com-8088.conf

重启Apache

sudo service apache2 restart

您还需要在example.com-8088.conf中添加SSL设置,或使用http://www.example.com:8088(而不是https)

访问它