[英]How to create a symlink of a directory inside another symlinked directory?
I succesfully deployed a Laravel website onto a web server by cloning it into a directory at the same level as public_html (called laravel) and creating a symlink to the laravel/public directory into public_html, with this command: ln -s laravel/public public_html
This works great.我成功地将 Laravel 网站部署到 Web 服务器上,方法是将其克隆到与 public_html(称为 laravel)同一级别的目录中,并使用以下命令将 laravel/public 目录的符号链接创建到 public_html 中: ln -s laravel/public public_html
这很好用。
Now I want to have a "test" version of the site for development, and I wanted to do the same.现在我想要一个用于开发的站点的“测试”版本,我也想这样做。
ln -s laravel_dev/public public_html/dev
It creates a file (not a directory) called public inside public_html/dev.如果我执行ln -s laravel_dev/public public_html/dev
它会在 public_html/dev 中创建一个名为 public 的文件(不是目录)。I tried making the target go to laravel/public/dev, with the same result.我尝试将目标转到 laravel/public/dev,结果相同。 I double checked that laravel_dev/public directory exists and it is not empty.我仔细检查了 laravel_dev/public 目录是否存在并且它不是空的。 I also tried removing the dev directory inside laravel/public/dev, and the result there is that it creates a file called dev inside laravel/public but it is not a directory.我还尝试删除 laravel/public/dev 中的 dev 目录,结果是它在 laravel/public 中创建了一个名为 dev 的文件,但它不是一个目录。
To clarify, my directory tree is something like this:澄清一下,我的目录树是这样的:
www
|___public_html(1)/dev
|___laravel/public(1*)/dev
|___laravel_dev/public
I am positioned in www directory when I am executing the mentioned commands The (number) indicates symlink and the * indicates the "physical" directory.当我执行上述命令时,我位于 www 目录中。(数字)表示符号链接,* 表示“物理”目录。 Using this notation here is what I want to acomplish:在这里使用这个符号是我想要完成的:
www
|___public_html(1)/dev(2)
|___laravel/public(1*)/dev(2)
|___laravel_dev/public(2*)
You should just make link in the physical directory.您应该只在物理目录中建立链接。
mkdir laravel{,_dev}
ln -s laravel public_html
ln -s ../laravel_dev laravel/dev
It gives me following directory/files tree它给了我以下目录/文件树
[Alex@Normandy so]$ tree
.
├── laravel
│ └── dev -> ../laravel_dev
├── laravel_dev
└── public_html -> laravel
Simple test:简单测试:
[Alex@Normandy so]$ echo "test dev" > laravel_dev/test
[Alex@Normandy so]$ cat public_html/dev/test
test dev
Note that there might be also problem with your webserver.请注意,您的网络服务器也可能存在问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.