简体   繁体   English

如何为linux web服务器创建符号链接

[英]How to create Symbolic link for linux web server

How to create the symbolic link for the path on web server(linux). 如何在Web服务器(linux)上创建路径的符号链接。

Suppose I want to create link for request url 假设我想为请求网址创建链接

http://localhost:8059/layerslider/skins/fullwidth/skin.css

And the file is present on server at location 并且该文件存在于服务器上的位置

/home/users/assets/plugins/layerslider/skins/fullwidth/skin.css

Do anyone know about it???? 有人知道吗????

Thanks 谢谢

Creating symbolic link does not recommended. 不建议创建符号链接。

But you have option to on this facility. 但您可以选择使用此设施。

In apache hosting confuguration file add this: 在apache托管confuguration文件中添加:

Options FollowSymLinks

And provide appropriate permission according to file needs. 并根据文件需求提供适当的权限。

And be specific answer to your question is: 并且具体回答你的问题是:

create symbolic as 创造象征性的

ls -s /home/users/assets/plugins/layerslider/ /web-rootFolder/layerslider

I think you have to change the location of localhost on server side. 我认为你必须在服务器端更改localhost的位置。

 sudo gedit /etc/apache2/sites-enabled/000-default

DocumentRoot /home/users/assets/plugins
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/users/assets/plugins
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

After save file (ctrl+o ctrl+x), restart apace. 保存文件(ctrl + o ctrl + x)后,重启快速。

sudo /etc/init.d/apache2 restart

To change the port: 要更改端口:

sudo nano /etc/apache2/ports.conf

See this is not good practice. 看到这不是好习惯。 But in some case we need to use it. 但在某些情况下,我们需要使用它。

But you need to first allow the symbolic links for the domain. 但您需要首先允许域的符号链接。

You can do it with configuation file of apache. 你可以用apache的配置文件来做。

Add this:: Options FollowSymLinks 添加:: 选项FollowSymLinks

Then you can create and apache2 allow to symbolic links. 然后你可以创建和apache2允许符号链接。

ln -s original_folder_soruce symbolic_link_path_name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM