Custom alias for RoundCube

inomi13

Verified User
Joined
Jan 7, 2022
Messages
162
When I added Include /etc/httpd/conf/extra/my-httpd/httpd-alias.conf in httpd-includes.conf this works but when I added Include /etc/httpd/conf/extra/my-httpd/httpd-modsecurity.conf server doesn't work.

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
 
but when I added Include /etc/httpd/conf/extra/my-httpd/httpd-modsecurity.conf server doesn't work.
That is because it should not be there. That directory is and that file is not mentioned in the docs.
Did you checked the docs correctly?

The correct place and directory should be (older still working method):
/usr/local/directadmin/custombuild/custom/modsecurity/conf/MYCUSTOMRULES.conf

or use the more modern method which is stated just a little bit lower, which is done via the GUI.

Check the Customizing ModSecurity Rules (click) from the link you posted yourself.
 
Not in that directory. If you want to have a custom httpd-alias.conf then just adjust your current httpd-alias.conf and restart apache.
This way you don't have to recompile apache right away.

After that, copy your httpd-alias.conf to here:
/usr/local/directadmin/custombuild/custom/ap2/conf/extra

Next time apache is updated, it will use that custom file.

But a quick question, what do you want to change in the httpd-alias.conf file? Maybe there is another (maybe better) solution for that one.
 
I want edit or add only one parametr. In httpd-alias.conf I have Alias /webmail /var/www/html/roundcube and now I change to
Alias /poczta /var/www/html/roundcube, but after rebuild CustomBuild my value return to default.

So I added /etc/httpd/conf/extra/my-httpd/httpd-alias.conf and I added Alias /poczta /var/www/html/roundcube.
In httpd-includes.conf I added above path and this solution enough for me. Can I leave it like this?
 
Last edited:
Can I leave it like this?
No to prevent it being overwritten by custombuild you have to create the custom directory's like stated above.
And then copy that httpd-alias.conf to
/usr/local/directadmin/custombuild/custom/ap2/conf/extra
as I stated above.

There is no /etc/httpd/conf/extra/my-httpd/ directory in use by anything. At least not with normal apache.

I will explain again. With full commands this time so you can copy and paste (use at own risk):

Login as root to SSH then use these commands.
Code:
cd /usr/local/directadmin/custombuild
mkdir -p custom/ap2/conf/extra

Now edit your original file which is:
/etc/httpd/conf/extra/httpd-alias.conf

when you are ready changing /webmail to /poczta then copy the file to the custom directory.
Code:
cp /etc/httpd/conf/extra/httpd-alias.conf /usr/local/directadmin/custombuild/custom/ap2/conf/extra/

Ready. Restart apache.

Maybe it's better if that /webmail would be translated to /poczta in the Polish translation, but I don't know if that would work correctly too in this case.
 
Thanks for your suggest, I did as you showed and this solution works but I have one more question.

Why my solution is wrong ? File etc/httpd/conf/extra/httpd-includes.conf can include any file which I want to add so I included my fie (httpd-alias.conf) from path /etc/httpd/conf/extra/my-httpd/httpd-alias.conf which has only value Alias /poczta /var/www/html/roundcube. I checked and rebuild custombuild and still my-httpd works.
 
Why my solution is wrong ?
Your solution isn't wrong. As stated, you can use the httpd-includes.conf as alternative. It's also good.
But it's an alternative. It's not wrong, but mostly it's better to use the default option instead of alternative.

But there is nothing wrong with the httpd-includes.conf if it works with that. If you find that easier to work with, you can use that too.

The only thing wrong (or at least if I'm not mistaken, never seen that before) in your posts is that directory "my-httpd" which should not exist as far as I know.

Normally the path to the httpd-alias.conf is:
/etc/httpd/conf/extra/httpd-alias.conf
and not
/etc/httpd/conf/extra/my-httpd/httpd-alias.conf

Which Linux Distro do you use?
 
I have all my configuration in path /etc/httpd/conf/extra/httpd-alias.conf but I include Alias /poczta /var/www/html/roundcube from directory path /etc/httpd/conf/extra/my-httpd/httpd-alias.conf

I have CentOS Linux release 7.9.2009 (Core)
 
Oke. I also have Centos 7.9.2009 and there should not be a /my-httpd/ directory present anywhere.

If you created it yourself and then included it in /etc/httpd/conf/extra/httpd-alias.conf then on the next update the httpd-alias.conf will be overwritten. Which is why you have to make the change in the /custom directory like explained, or in your httpd-includes.conf as that is the only file which will not be overwritten.
 
Above solution is good but not perfect for me because your solution redirect to name_server/roundcube but my solution open page from domain_name/poczta.

In my option, my solution is better for users because they see their domain name in url don't url domain server.
 
If a redirect occurs, then that's how a server is configured:

Code:
grep -E "use_hostname_for_alias|redirect_host" /usr/local/directadmin/custombuild/options.conf

By default there is no redirect:

Code:
[root ~]# grep -E "use_hostname_for_alias|redirect_host" /usr/local/directadmin/custombuild/options.conf
use_hostname_for_alias=no
redirect_host=no
redirect_host_https=no
[root ~]#

That's an official way for making a redirect. There are custom solutions for the same thing too.

One can check it with another default URL: https://hostname/webmail/

p.s. Anybody here is free to use any suitable solution, and to do anything they want on their servers. If suggested solution does no fit your needs, it might be useful for others.
 
You have right, If your solution don't for me, maybe someone will use it. Again thanks all for the time :)
 
Back
Top