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: - 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.

  • 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? Apr 28 '20 at 18:08
  • No, I'm not setting anything in Nginx for this domain/server. Just: location / { proxy_pass 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.
    – Yogesch
    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. serverfault.com/questions/598202/…
    – Yogesch
    Apr 28 '20 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.