I'm having trouble configuring Nginx as a reverse proxy in an application. It is a Rails application, which runs on unicorn.
In this case, I have the link domain. Instead of creating a subdomain, I'd like link to be the root url and direct the requisitions to my application. Looking at OS in English I saw some possible solutions. I tried some, and following the one that came closer to working, my configuration file looks like this:
upstream meuprojeto {
server unix:/var/www/apps/meuprojeto/shared/tmp/sockets/meuprojeto.sock;
}
server {
listen 80;
server_name meuprojeto.com.br max_fails=0;
index index.html;
root /var/www/apps/meu_projeto/current/public;
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
error_log /var/log/nginx/meu_projeto.log debug;
location /meuprojeto {
rewrite ^/meuprojeto/(.*)$ /$1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://meuprojeto/;
}
}
With this setting, when I access link , the request is correctly directed to the home page of my application, but all links will no longer work, since the url's generated are like link , when they should be something like link . What do I do to make it work? Is the configuration in Nginx or should it be done in Rails?