1

In rails 3.1 I was able to put a symbolic link to a directory of html pages in my public folder and it worked. Now in rails 3.2 it gives me a 404 not found page when I try to open any of those html files. What changed in rails 3.2 that now blocks symbolic links and how can I get around it?

To clarify, I have a friend who wants to save money by having his site hosted off mine. So when I deploy his site should be accessible at http://mysite.org/hissite/. He has an account on the same server as me so I just create a symbolic link to the directory hissite which is located in his account. I put this symbolic link in my public folder. Prior to upgrading to rails 3.2 this worked like a charm. I can use a hard directory but this would be on my account requiring him to send me updates which I would then have to post. This is a big hassle. It is important for me to allow him to host his content with my site as it is related content and helps bring more visitors to my site.

More details: The problem is with my production site which is using passenger. In development, I tested it with a symlinked directory on my development machine and it worked fine. Hard links seem to work in production but then I have to update the directory whenever he adds new files which is a hassle.

Eric Coulthard
  • 500
  • 6
  • 20

1 Answers1

0

Well I figured out a hack to get it to work but it is not what I would like. I wrote a capistrano task to link the files whenever I do a deployment. So my capistrano task looks like this.

namespace :accounts do
    desc "Relink friend's site on each release"
    task :relink_friends_site, :roles => :app do
        run "mkdir -p #{release_path}/public/hissite"
        run "cd #{release_path}/public/hissite && ln /home/hisaccount/hissite/index.html"
        run "cd #{release_path}/public/hissite && ln /home/hisaccount/hissite/page2.html"
        ...
    end
end

If anyone knows a better way to fix this please let me know. At least this way I don't have to relink the files myself foreach deployment.

Eric Coulthard
  • 500
  • 6
  • 20