Can my /public directory be a symlink with rails 3 + passenger 3 + nginx 0.8?

后端 未结 3 2006
攒了一身酷
攒了一身酷 2020-12-17 02:23

I\'m putting together a rails deployment where the public directory is a symlink to another directory on the system. This is with passenger 3 on nginx .8. It does\'t seem

相关标签:
3条回答
  • 2020-12-17 02:39

    I was able to do this with the guide linked below.

    1. Create your rails app in /var/www/html
    2. Delete default.
    3. Edit the /etc/nginx/nginx.conf file
    4. symlink to sites-enabled
    5. Restart nginx

    How to Deploy Ruby on Rails with Passenger and Nginx on Ubuntu 16.04

    0 讨论(0)
  • 2020-12-17 02:40

    Can't you use the following:

    mount --bind /original_path /your_ngnix_root_path
    

    instead of using symlinks? For ngnix it would be a usual directory, why it will point to another directory as you wanted it to be.

    0 讨论(0)
  • 2020-12-17 02:59

    I think it is not possible to use a symlinked public directory. The only workaround I can imagine is to symlink any file and directory inside of the public dir.

    # public folder: /data/public
    # app folder: /webapp/
    mkdir -p /webapp/public && ln -sf /data/public/* /webapp/public/
    

    For every new file or directory in /data/public you have to run this command again.

    0 讨论(0)
提交回复
热议问题