• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Subdomains redirect to primary domain after repairing installation (v12.0.18)

Pyro1

New Pleskian
Dear Community,

Up until a week ago we had some troubles with package dependencies on our dedicated server running on Ubuntu 14.04.1. Plesk was totally out of reach, displaying 502 Bad Gateway pages and some other weird error on login_up.php3.

I fixed the dependencies by removing a lot of packages (including Plesk) and finally managed to reinstall Plesk using the autoinstaller, then repaired it using "/usr/local/psa/bootstrapper/pp12.0.18-bootstrapper/bootstrapper.sh" (IIRC this whole bootstrapper folder was not present before reinstallation).

Now, after restoring our data from a backup pretty much everything works except for the subdomains. They all redirect to the primary domain's vhost (307 Redirect) for some reason.

"/var/log/apache2/access.log" shows the following after issuing a HTTP request to any subdomain:
Code:
<ip> - - [23/Jan/2015:23:15:31 +0100] "GET / HTTP/1.1" 307 244 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0"
<ip> - - [23/Jan/2015:23:15:31 +0100] "GET / HTTP/1.1" 200 13397 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0"

I hope someone can push me in the right direction. I have tried enabling and disabling nginx, it did not help. Then I just kept it disabled because it makes our forum think that everyone has the server's IP (because of the reverse proxy thing I assume).

Oh, and I should say: using HTTPS anywhere just gets me a 502 Bad Gateway error.

Thanks for reading,
Pyro
 
Hello Pyro,

That sounds like vhost mis-configurations. Normally rebuilding vhosts solves the problem. Had you already attempted this option?
 
Yes, I have done it via CLI and GUI. Also searched for other scripts in /usr/local/psa/bin and /usr/local/psa/admin/bin and tried the bootstrapper repair again to no success.
 
Last edited:
That is unfortunate,

Normally I would start my investigations with:
  1. Verifying that ALL DNS records are correct and include the respective subdomain names A records.
  2. Look at the actual sub-domain vhosts to ensure existence of the respective records (Chance are these don't exist for you)
  3. Through the control panel, make a change on the subdomain, this normally would regenerate its respective vhost.
If you like I can help check it out for you!
 
Hello Pyro,
Thank you for giving me an opportunity to help you!

Below is a debrief and findings of my investigation in regarding to your sub-domains not working as expected.

For starters NON of the plesk commands could help or make a change to the web server configs regardless. This therefore pushed me to get to the bottom of Apache and its functionality.

Closely investigating I noticed that your Apache web server was a standalone. It was NOT connected / linked with plesk. Normally the link between Apache and plesk is achieved by the line:

Code:
IncludeOptional conf.d/*.conf

Unfortunately that line was inexistent, and instead what you had was
Code:
IncludeOptional sites-enabled/*.conf

Because of the above, Apache was therefore processing the default vhost found in
Code:
sites-enabled/000-default.conf
which apparently had the document root as:
Code:
DocumentRoot /var/www/vhosts/a***.eu/httpdocs

This is why ALL domain names and sub-domain names on the server were being fetched from your primary domain name.

I did repair apache by adding the correct connection to plesk and as such all your domains and sub-domains started to function normally.

Of-course, normally when you regenerate the vhosts using the plesk inbuilt command
Code:
/usr/local/psa/admin/sbin/httpdmng --reconfigure-all
this should also repair the apache.conf file to ensure of the connection between Apache and Plesk.

Unfortunately this didn't and this is a BUG in plesk. Perhaps Igor you should report this bug report.

Finely, your cms.** domain vhost had a problem with inclusion of modules
Code:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.53/buildout/apache2/mod_passenger.s

Since the above module was inexistent, the apache restart couldn't work, so I disabled that line ...

BTW: Did you just copy the apache.conf file from some NON plesk server location to your plesk server? It didn't look like a truely plesk apache.conf file. It seems also that you edited it with windows OS and uploaded it through SFTP.

Anyways, all should be fine ..
 
Thank you so much for helping us out!

Perhaps I should have mentioned that apache was one of the packages I had to delete and reinstall in the course of fixing package dependencies.
This line
Code:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.53/buildout/apache2/mod_passenger.so
is necessary for running a Ruby on Rails application using Apache, Passenger and RVM. I'll just have to find a way to make Passenger use the RVM ruby now. But I'm sure I'll get that fixed eventually.
 
Last edited:
Back
Top