Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Trying to figure out what's wrong with Nginx configured as reverse proxy to Apache. There are no problems at the backend (see below), yet nothing is being shown to the end client (browser).

System: Ubuntu 12.04 running on Amazon EC2 with Apache2 running successfully for the domain xxx.com (there is a redirection from xxx.com to www.xxx.com written in .htaccess). I need to install Nginx on top of it, but do not want to break the live site. So Nginx (installed both from ports and then compiled from source) is running on 8080 port (different ports were tried, e.g. 81). Now, in order to check that Nginx works, the simplest config is used.

listen *:8080;
server_name www.xxx.com;

location / {
proxy_pass http://localhost:80; # trailing slash was tried also
# tried www.xxx.com:80 and xxx.xxx.xxx.xxx:80 and;
include /etc/nginx/proxy_params;


Nginx is listening to 8080 without any errors. No access details in both nginx and apache access.log or error.log. Browsers "hang" indefinitely. Apache is serving the site on port 80 successfully. I can telnet both on 80 and 8080 (and netstat shows both apache and nginx listening to their ports).

The question is what has been done wrong or how to track down the nature of the issue?

share|improve this question
What do you have in /etc/nginx/proxy_params? –  Michael Hampton Jul 16 '12 at 22:51
What is your netstat -tlnp ? –  golja Jul 16 '12 at 23:17
@MichaelHampton The standard stuff - proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; –  alexei.shulga Jul 16 '12 at 23:18
@golja: pastebin.com/qHkueRPr –  alexei.shulga Jul 16 '12 at 23:20
OK, now we're getting somewhere. What is the content of your /etc/hosts file? –  Michael Hampton Jul 16 '12 at 23:27
show 1 more comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.