Page is redirected to another in a same VPS

Discussion in 'General' started by Rolsbek, Jun 7, 2020.

  1. Rolsbek

    Rolsbek New Member

    Hi, I have a vps that I manage with ispconfig 3.

    The problem is that I have a website that is being redirected to another one.

    That is, I think Apache is not creating individual ports for each page, and has taken a main for all pages to which it redirects. Someone knows how to fix this.
  2. Steini86

    Steini86 Active Member

    This is a common problem and discussed almost every month in this forum, just use the search function.
    Usually, because of one of these two reasons:
    1) Do not mix "*" and "ip" in the website settings for the listen directive. Will confuse apache
    2) Do not mix SSL and non-SSL sites. If you access a website on https (Port 443) which does not exist (no SSL config), Apache will show first working vhost instead.

    So: Use * for all webs and activate SSL for all.
  3. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    this question does appear in the forum alarmingly frequently, would it not be worth having a sticky post describing the problem and the possible solutions....
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, a sticky post is a good idea. I've also considered for 3.1.16 to hide the IP selector field by default in the website + defaulting to *, so it's shown only in the case that it is activated plus having at least one IP under system > server IP.
    Th0m likes this.
  5. Rolsbek

    Rolsbek New Member

    I think that's what I've done, each virtual server has it configured with * and each website has its own ssl. All this I've been taking out thanks to the help of forum posts and the great work of Till and others.

    But I'm a bit stuck.

    I attach a row to see how I have configured a web in /etc/apache2/sites-available

    So I have all the websites, each one going to its own folder of course, today I added another website, and they all redirect me to that website, I don't know why, even phpmyadmin redirects me to the website. I've made a mess of it everywhere and I don't really understand where.


    I also have this error or warning line when I run sudo apache2ctl configtest :

    NameVirtualHost has no effect and will be removed in the next release /etc/apache2/ports.conf:1

    I don't understand very well, I leave the ports configuration to you


    I'm sorry for the trouble and thank you for your help.
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    This site does not look as if it's managed with ISPConfig. Neither the content nor the file name matches the way ISPConfig is managing sites. Creating site config files manually on an ISPConfig server can lead to all kind of problems, either use ISPConfig to manage your server or write your configs by hand. And when a new config file that you added manually redirects all sites to this site, then you have either one of the problems that is mentioned at the beginning of the thread like ssl/no-ssl problem or * and IP problem.
  7. Rolsbek

    Rolsbek New Member

    It is managed by ispconfig

  8. Rolsbek

    Rolsbek New Member

    But in the configuration file of the website.conf sites-available you don't seem to have the problem mentioned by the partner, do you?
  9. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    how did you install letsencrypt? and how do you create and add the certificates?

    your vhosts show certs as
    SSLCertificateFile /etc/letsencrypt/live/
    SSLCertificateKeyFile /etc/letsencrypt/live/

    which I believe should be:
    SSLCertificateFile /var/www/clients/<clientid>/<webid>/ssl/
    SSLCertificateKeyFile /var/www/clients/<clientid>/<webid>/ssl/
    and these should symlink to the letsencrypt files.

    that config in itself shouldn't cause you problems though, but if letsencrypt/certbot has been installed and used to create certificates outside of ispconfig, that can create changes in config files that will break things.
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Neither the file name of the file you posted matches the naming scheme in ispconfig, vhost files always end with .vhost file ending and never with .conf file name ending, nor the content of the files match the vhost templates that ship with ISPConfig. So either the file contents and names are not the ones from that ispconfig server of the files were not created by ISPConfig.
  11. Rolsbek

    Rolsbek New Member

    I followed this guide to create letsencrypt ssl

    And the truth is, it hasn't given me any problems until I've set up this new domain
  12. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    i'm surprised that hasn't given you any problems before, that guide isn't even close to how ispconfig manages letsencrypt certificates.

    what os is this on? and what version of ispconfig are you running?
  13. Rolsbek

    Rolsbek New Member

    Yes, all files have been created by ispconfig, the thing is that they have been manually modified by me, but I have saved copies before manipulating. Here is the example of the vhots file before it was manipulated and changed to .conf.

  14. Rolsbek

    Rolsbek New Member

    I have a Vps with ubuntu 16.04 with ispconfig 3
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    Then undo your manual file changes and undo the wrong renaming as this must cause issues. same with the way you enable LE SSL certs, ISPConfig has a checkbox for that, simply enable it, that's all. The way you did must collide with the way ISPConfig and LE works.
  16. Rolsbek

    Rolsbek New Member

    I've undone all the changes, each site points to the port with * instead of ip, in the ssl it has the structure that put @nhybgtvfr from SSLCertificateFile /var/www/clients/<clientid>/<webid>/ssl/ but all still redirect to the same domain.
    I also worry that I had some problems with phpmyadmin, I executed these commands

    sudo apt-get remove --purge phpmyadmin php-gettext php-mbstring -y
    sudo apt-get autoremove - and
    sudo apt-get update
    sudo apt-get install phpmyadmin php-gettext php-mbstring -y

    And now by putting http://serverip/phpmyadmin or https and it redirects me to the website.
  17. Rolsbek

    Rolsbek New Member

    Ok, thanks to sudo apache2ctl configtest I saw that it had syntax error in sites-enabled, when correcting it already each url is redirected to its own, now just a url in its http version gives me the index ?¿?¿? and in https error 403.
  18. Steini86

    Steini86 Active Member

    When you get an error from Apache, there will be a log entry in the error.log with additional information on how to solve it.

Share This Page