0

I'm trying to configure nginx as reverse proxy:

apache: listen on localhost:8777 nginx: listen on port 80

But I go to http:/blog.example.com/blog, browser it outputs:

Error - http://blog.example.com:8777/

No se pudo cargar la página 'http://blog.example.com:8777/'.

Cannot connect to destination (blog.example.com)

My nginx.conf is as follows:

user  nginx;
worker_processes  1;
error_log  /var/log/nginx/error.log;
pid        /run/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    keepalive_timeout  65;
    index   index.html index.htm;
    include /etc/nginx/conf.d/*.conf;
    server {
        listen       80 default_server;
        server_name  blog.example.com;
        root         /usr/share/nginx/html;
        include /etc/nginx/default.d/*.conf;
        location / {
       proxy_pass http://localhost:8777;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        }
        error_page  404              /404.html;
        location = /40x.html {
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
        }
    }
}

The strange is that if I've create a html file by hand there is no problem, the content is shown. What am I doing wrong?

2
  • Well, I've deleted all files from Document Root, copied wordpress files and now it seems working. I don't know why.
    – sebelk
    Apr 14, 2015 at 21:31
  • If your blog URL is http:/blog.example.com/blog, you should put the wordpress files in <Apache DocumentRoot>/blog.
    – Chris Lam
    Apr 15, 2015 at 1:55

0

You must log in to answer this question.

Browse other questions tagged .