web and mail server under same ip with different names

September 19, 2016 228 views
Email Server Optimization Ubuntu

i have followed this tutorial to set up Mail server in existing Web server droplet.

hostname: box.somename.com

i also have domain with name www.somename.com
Name servers are ns1.box.somename.com and ns2.box.somename.com
Host Names are ns1.box ip_address and ns2.box ip_address

after installing mail server (successfully) my domain www.somename.com is pointing to mail server. but i want it to be separate like

www.somename.com  --> normal web page hosted in same droplet (using ngnix)

box.somename.com --> mail server landing page

how can i achieve this.

  • This should be possible through some modification to your Apache configuration. Can you share the contents of the files located in /etc/apache2/sites-enabled on your droplet?

  • i'm using nginx

    and yes i modified the config files under /etc/nginx/sites-enabled/
    but the problem here is Mail in a box is creating (changing dynamically) a file /etc/nginx/conf.d/local.conf with 2 domain names

    1. box.somename.com
    2. somename.com

    both are pointing to same to location /home/user-data/www/default
    which is what i dont want.

    editing of this file is useless since its get updated frequently by Mail-in-a-box
    so i added new entry to /etc/nginx/sites-enabled/ to override the one local.conf
    but looks like its not working

Be the first one to answer this question.