proxy pass of subfolder with php

Discussion in 'Installation/Configuration' started by ddelbia, Feb 6, 2025.

  1. ddelbia

    ddelbia Member

    Hi,
    On ispconfig server with nginx, I need todo a proxy_pass of www.domain.com/shop to shop.domain.com, both on the same server.

    I tried adding this in the Option tab:
    Code:
    location /shop/ {
       proxy_pass https://shop.domain.com/;
    }
    It works for all URLs execept those ending in .php
    I think because the location ~ \.php$ has priority.

    Can someone help me?
    Thank you
     
  2. remkoh

    remkoh Well-Known Member HowtoForge Supporter

    Make sure "location /shop/" comes before "location ~ \.php$" in your config.

    I asume you added "location /shop/" as a nginx directive?
    You can delete the default php config using
    Code:
    location ~ \.php$ { ##delete##
    }
    
    location @php { ##delete##
    }
    
    and add php config again after "location /shop/" if you need php.
     
    Last edited: Feb 6, 2025
    till likes this.
  3. ddelbia

    ddelbia Member

    Thank you for you reply remkoh
    I tried it editing the virtual host (ispconfig wouldn't allow it) by hand, but I get the same behavior
    I think nginx gives priority to the more complex expression first, regardless the position
     
  4. remkoh

    remkoh Well-Known Member HowtoForge Supporter

    No it should be an order issue.
     
    till likes this.

Share This Page