PHP not working with HTTPS (ISPConfig)

Discussion in 'General' started by Spaniole Olsen, Sep 30, 2021.

Tags:
  1. Spaniole Olsen

    Spaniole Olsen New Member

    I'm trying to get PHP working with HTTPS (https:// skytjenesten . dk / hello.php), but I'm getting the following error:
    --------------------------------------------------
    ERROR 403 - Forbidden!
    The following error occurred:
    You are not permitted to access the requested URL.

    Please contact the webmaster with any queries.
    --------------------------------------------------

    PHP is working with only HTTP
    http:// skytjenesten . dk / hello.php

    HTML is okay for the site, also with HTTPS -> https:// skytjenesten . dk

    I'm running Ubuntu 20.04.3 with ISPConfig 3.2.6, and I do have a lot of other PHP sites running on the same system without problems at all.
    PHP is enabled for the specific site.

    What can I do to get PHP and HTTPS running along side for the specific site.
    (had to do some spaces in the links, or I could not post).

    Thanks.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Have a look at the error.log of the website and post the error that you get there when the forbidden message shows up. Technically, it's not possible in my opinion that PHP works only for the HTTP but not https version of a site in ISPConfig, so the more likely reason is that there is a different issue e.g. that the https request ends up in another site or something similar. At the moment, your site is neither reachable by HTTP nor https, neither with nor without php.
     
  3. Spaniole Olsen

    Spaniole Olsen New Member

    Thanks for the reply.

    There is nothing writing to the Apache error.log at the given time.

    The only thing where I can see something is in the "other_vhosts_access.log" as like this:
    HTTPS: skytjenesten.dk:443 X.X.X.149 - - [30/Sep/2021:16:54:36 +0200] "GET /hello.php HTTP/1.1" 403 2719 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36"
    HTTP: skytjenesten.dk:80 X.X.X.149 - - [30/Sep/2021:16:52:25 +0200] "GET /hello.php HTTP/1.1" 200 425 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36"

    And you are right, it does not give any sense - but I do indeed have the problem.

    And sorry for the denied access, just forgotten that the webserver only can be accessed from my country - are doing some geo-blocking (it is only for national use - was tired of some countries trying to lay down my system).
     
  4. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    What does 'apachectl -S' show?
     
  5. Spaniole Olsen

    Spaniole Olsen New Member

    The "apachectl -S" shows what is in the attached file (still can't insert links).
     

    Attached Files:

  6. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    You do not have a port 443 vhost for skytjenesten.dk, so as @till said:
    Maybe disable ssl for the site, delete anything under the fields on the SSL tab, and enable/setup SSL again.
     
  7. Spaniole Olsen

    Spaniole Olsen New Member

    Thanks for reply. As I wrote earlier, the site can only be accessed from my own country, therefor you might be redirected to something else.
    The site works fine with HTML and HTTPS, please see attached screendump.
     

    Attached Files:

  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post the vhost configuration file of the site, you can find it in /etc/apache2/sites-enabled/
    And also check that there is no vhost file for the site with .err file ending in /etc/apache2/sites-available/
     
  9. Spaniole Olsen

    Spaniole Olsen New Member

    Hereby some vhost's file attached - there are no files ending with .err in /etc/apache2/sites-available/
    I appreciate your help, thank you very much.
     

    Attached Files:

  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, there is the problem, you seem to have used certbot manually on the shell, this will completely break the vhost and makes it unusable. To fix that, delete the skytjenesten.dk.vhost-le-ssl.conf file. Enable LE SSL for a site in ISPConfig only, never use certbot manually on the shell for that as certbot will break your config.
     
    ahrasis likes this.
  11. Spaniole Olsen

    Spaniole Olsen New Member

    Maybe your right, but what about the other 40 sites at the same system, where I also used manually certbot, and where it is working like a charm with PHP. I have never had success with the ISPConfig build in LE, maybe because my port 80 are pointing to another server (IIS - it redirects 443 traffic to the ISPConfig server by an internal DNS) and it is only port 443 there are pointing to the ISPConfig server (I do some manually renewing of the certificates every 3 months). 1 LE certificate holds several alternative names, therefor the name of the certificate is skyservice.dk. Thanks.
     
  12. Spaniole Olsen

    Spaniole Olsen New Member

    You were absolutely right, I did as you told, and now everything is working as it should - thank you very much. Case can be closed.
     
    ahrasis likes this.

Share This Page