I would like to have my base domain as well as the alias redirect to webmail. For example, example.com/mail goes to roundcube but I would like to be able to go example.com as well go to roundcube. How do you do this? Do I change the nginx file in connf.d and do a rewrite rule? Any code would help.
According to the git convo. I need to add a folder called “includes” in “/etc/nginx/conf.d” ? Then add a file to redirect from base domain to domain/mail, is this correct? Do I need to add include statement in any other file or is this automatically done? I tried this option with no success. I restarted and did a nginx -t check and both were fine but no redirect.
I don’t understand the managment/web_update.py file. I’m not sure how to use it for my needs. I need to pass something like config file, assuming that would be the nginx file for which I want to add to the server. Which function do I use or a example would be great?
I went with a third option, which is probaly the worst option. I edited the local.conf file and edit the 443 for my base domain and comment out these lines.
#root /home/user-data/www/default;
#index index.html index.htm;
and added this line. I restarted and it works. for both example.com and https://example.com
rewrite ^/$ /mail redirect;
Old topic, but still unsolved!
I created a file in /etc/nginx/conf.d/includes/example.com.conf
containing:
rewrite ^/$ /mail redirect;
Then ran /root/mailinabox/tools/web_update
. It did not make any changes to my local.conf file. For good measure I copied the file to /etc/nginx/conf.d/includes/mail.example.com.conf
(matching the hostname I use) and that did not get included either, even though there are sections in my local.conf
for both example.com
and mail.example.com
. How is this supposed to work?