Make an alias for Webmail

Asked

Viewed 29 times

0

I am not able to make an alias for my Webmail in Debian 8, I am editing the /etc/hosts to make the alias, it is not working, see:

Alias for my website

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

ServerAdmin [email protected]
 ServerName example.com.br
 ServerAlias www.example.com.br
DocumentRoot /var/www/example.com.br/public_html
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

Alias for the Webmail

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

ServerAdmin [email protected]
 ServerName webmail.example.com.br
 ServerAlias www.webmail.example.com.br
DocumentRoot /usr/share/squirrelmail/
#DocumentRoot /var/www/example.com.br/public_html
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

I want when you type Webmail.example.com to go to Webmail /usr/share/squirrelmail/

1 answer

1


Alias are created in the archive Apache2.conf and should be edited as:

<VirtualHost *:80>
        ServerName example.com.br
        DocumentRoot /var/www/html_publlic
</VirtualHost>

<VirtualHost *:80>
        ServerName webmail.example.com.br
        DocumentRoot /usr/share/squirrelmail/
</VirtualHost>

Done that, teach to the Apache to recognize the alias, add this data to the archive hosts which gets into /etc/:

69.72.189.110   example.com.br
69.72.189.110   webmail.example.com.br
127.0.0.1       example.com.br
127.0.0.1       webmail.example.com.br

PS: Use your machine IP.

Ready to go ;) Your alias is already working.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.