0

I have a smoothly running FreeBSD box with a couple of jails running their own servers.

Nginx runs in its own jail and the main machine uses pf to redirect all http/s requests to Nginx. Nginx checks the requested domain name and does a proxy-pass to the appropriate jail.

This is my first time using Apache/PHP as I just decided to install opencart on a new jail.

The trouble is when I load up the opencart install page, it gets the index.php correctly but then it looks for all the other static files in bad places like this: http://192.168.100.4/install/view/stylesheet/stylesheet.css - which is basically the internal address of the jail.

I need it to look for the same file, using the domain name instead of the IP address like so: http://shop.foobar.com/install/view/stylesheet/stylesheet.css

I am almost (because there are many variables involved) sure this can be done by some php/apache setting, but I haven't been able to figure out how, despite having spent too much time on google. Is the problem due to Apache or something else (pf?), and how can I fix it? Given the annoying nature of this problem, clues might be just as useful as answers.

dakini
  • 325
  • 3
  • 13
  • 1
    I don't know how opencart determines its domain name. It's either configured or it's deduced from the Host header. Are you setting the Host header in Nginx? – Richard Smith Apr 28 '20 at 18:08
  • No, I'm not setting anything in Nginx for this domain/server. Just: location / { proxy_pass http://internal.ip:port/; } So everything is handled by Apache. Because most documentation on opencart use Apache, so I wanted to be able to recreate that "standard" setup as far as possible. – dakini Apr 28 '20 at 18:16
  • @RichardSmith you are a genius! Or at least, you solved my immediate problem. I used Nginx to fix it, thanks to your idea. https://serverfault.com/questions/598202/make-nginx-to-pass-hostname-of-the-upstream-when-reverseproxying – dakini Apr 28 '20 at 18:46

0 Answers0