I’m running a VPS (Debian 9) with Apache2 service running on it. I want to have a mail.example.com direct traffic to /var/www/mail and example.com to direct traffic to /var/www/example. I have written and rewritten the virtual hosts conf many times and mail.example.com always directs traffic to the wrong place on my machine.

Could it have something to do with certbot/letsencrypt? I know it changes apache settings. When I first made my SSL cert, I made a rule for mail.example.com but “told” let’s encrypt it was located in the other location. Any help would be appreciated.

I will add specific information when I am off of work.

  • You should indeed start by providing the configuration that you say is not working because your setup is very very generic, nothing special. – Patrick Mevzek Jun 5 '18 at 1:15
  • Hey, I figured it. There were RewriteEngine rules at the bottom of my Virtual-Hosts.conf files that I believe were generated by certbot. Removing these lines brought about the intended behavior. – OurGuyJohn Jun 5 '18 at 18:05
  • Then answer your own question and mark it as accepted. – Patrick Mevzek Jun 5 '18 at 18:44

There were lines of code that needed to be removed from the virtualhost.conf files. I removed them and things work as intended.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.