Hi I am used to working with Apache and Mod proxy where I my server configuration looks a bit like this and I redirect all incoming requests from
ServerName example.com DocumentRoot /var/www/trunk/public ServerName www.example.com Redirect permanent / http://mentoredge.com ProxyPreserveHost On ServerName o.example.com ProxyPass / http://localhost:8000/ ProxyPassReverse / http://localhost:8000/
Here I route all my incoming request on o.example.com to port 8000 of localhost.
I have migrated to Nginx now im trying to setup this proxy for the same o.example.com. Could somebody explain to me how to get this done.
server {
listen 80;
server_name o.example.com;
location / {
proxy_pass http://localhost:8000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;
proxy_set_header X-Forwarded-Server $host;
}
}
This is what I have added to my conf but this does not seem to do what I expect it do. Am I missing something here. The thing is I store it as a separate .conf file and it gets added first before all other server information.