I don't know what to do anymore.

I have a nginx server set up passing reuqests to a port on the same machine where a apache2 server is listening (yes this is neccessary).

I'm doing this by using

location /

in nginx.

This is working fine with a simple HTML-file with plain text. Now I wnated to set up Wordpress and saw that the CSS was missing. That was because my browser tried to get CSS files (and other) from instead of http://example.com/somefilehere.css. Obviously this is not what I want but I have no idea on how to fix that. I also don't know what further information to give so feel free to ask.


To specify the problem, all the references in the HTML are pointing to localhost (the clients computer), where no css and other stuff is, of course.

Thanks and have a nice day!

  • Wordpress needs to know its URL, see this link for details of setting HOME and SITEURL. Oct 15, 2016 at 14:58
  • @RichardSmith The problem already occures on setup, so this is not where the failure is.
    – user380973
    Oct 15, 2016 at 15:34

2 Answers 2


I think you may be done by adding this to your location block:

proxy_set_header Host            $host;

This way, your Apache server knows what website the user is visiting.

BTW, if possible, have Nginx serve the static files. That's what Nginx is good at, and Apache bad. Make separate location blocks for css, jpg, png, etc. There are numerous examples on the web.

  • This didn't change anything.
    – user380973
    Oct 15, 2016 at 15:37
  • Wait, it changed the references in the HTML! Something else is still wrong, but this is one step forward!
    – user380973
    Oct 15, 2016 at 15:46

Perhaps the failure is not on nginx, but on Apache not recognizing a valid host part of the URL.

A simple test would rule that out: From the same machine, try accessing that CSS file directly from the Apache server:


If that returns the file without error, you may want to post the access and error logs from nginx (enabling them if not already available). Ref: https://www.nginx.com/resources/admin-guide/logging-and-monitoring/

If you get an error from curl, you should check which ip addresses Apache is listening to (should be, port 1000, and not an specific ip or network that leaves the loopback interface out).

Also, check that the servername and virtual hosts directives in Apache config file(s) include (or localhost) as a served domain.

Hope it helps!

  • Accessing the files from the machine is no problem. The problem is that something makes the references in the HTML pointing to localhost where of course nothing is...
    – user380973
    Oct 15, 2016 at 15:39

You must log in to answer this question.