Make an alias for webmail

0

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

Aliases for my site

<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>

Webmail alias

<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 go to webmail / usr / share / squirrelmail /

    
asked by anonymous 23.11.2017 / 14:00

1 answer

1

Alias are created in the file Apache2.conf and should be edited like this:

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

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

When you do this, teach Apache to recognize the alias , add this data to the file hosts which is in /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 the IP of your machine.

Ready;) Your alias is already working.

    
23.11.2017 / 15:08