Apache在某些端口上侦听

时间:2015-09-02 22:37:02

标签: apache mod-rewrite centos alias httpd.conf

我正在运行kolab服务器并试图通过让网络管理员监听某个端口来提高安全性..我选择了8443.这是我的conf文件:

Alias /kolab-webadmin /usr/share/kolab-webadmin/public_html/

<Directory "/usr/share/kolab-webadmin/public_html/">
    <IfModule mod_rewrite.c>
        RewriteEngine on
        # NOTE: This needs to point to the base uri of your installation.
        RewriteBase /kolab-webadmin/

        # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} !=/favicon.ico
        RewriteRule ^api/(.*)\.(.*)$ api/index.php?service=$1&method=$2 [L,QSA]

    </IfModule>

    AddDefaultCharset   UTF-8
    php_value error_reporting      6135

    DirectoryIndex index.php
    AllowOverride All

    <ifModule mod_authz_core.c>
        Require all granted
    </ifModule>
    <ifModule !mod_authz_core.c>
        Order Allow,Deny
        Allow from All
    </ifModule>

</Directory>

我不确定如何使这项工作......我也在使用centos 6.6

修改

我只希望这个特定地址在端口8443上听...

所以domain.com/something将在端口80上运行

但domain.com/kolab-webadmin仅适用于8443

1 个答案:

答案 0 :(得分:0)

试试这个:

Listen 8443
NameVirtualHost yourdomain.com:8443
<VirtualHost yourdomain.com:8443>
    ServerAdmin postmaster@yourdomain.com
    DocumentRoot "yourDocumentRoot"
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    Alias /kolab-webadmin /usr/share/kolab-webadmin/public_html/

    <Directory "/usr/share/kolab-webadmin/public_html/">
        <IfModule mod_rewrite.c>
            RewriteEngine on
            # NOTE: This needs to point to the base uri of your installation.
            RewriteBase /kolab-webadmin/

            # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_URI} !=/favicon.ico
            RewriteRule ^api/(.*)\.(.*)$ api/index.php?service=$1&method=$2 [L,QSA]

        </IfModule>

        AddDefaultCharset   UTF-8
        php_value error_reporting      6135

        DirectoryIndex index.php
        AllowOverride All

        <ifModule mod_authz_core.c>
            Require all granted
        </ifModule>
        <ifModule !mod_authz_core.c>
            Order Allow,Deny
            Allow from All
        </ifModule>

    </Directory>
</VirtualHost>