using symlinks for /home/"username" and /var/www/html
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
using symlinks for /home/"username" and /var/www/html
hello All,
i am currently using RHEL 4 and I wont consider myself as a newbie but i do need some help (as all of us do, in some way shape or form). Now I am just learning to configure the Apache Web server but i am not experienced enough with this. I do know that pages are displayed on /var/www/html but i created a webdocs folder in my /home/"syed". i would like to know if there are any scripts so that whatever i do in my home folder, that would be copied over to my /var/www/html folder. For example, if i could just have my webdocs be automatically syncronized with my /var/www/html. Also if i create a new user, is there any way that i could just have the directory copied to both places. Thanks.
Syed Zaidi
i do something similar, and i think my way is a heck of a lot less trouble.
1) enable userdir support, serving pages from /home/[name]/public_html.
2) in /var/www/html, i just place a symlink of
/var/www/html/syed --> /home/syed/public_html
it ill help to have /home/[directories]/.. readable by apache.
after this, anything you place your your homedirs public_html folder, will be viewable at www.domain.com/syed. now, normally, this exact same concept is accomplished just thru the turning on of the homedir support, without all the symlinks, and just going to www.domain.com/~syed, but i have a few sites that i host, where i just created an account of the domain name, which is held under /home. instead of putting the sites files in /var/www/html, and mucking about with the permissions to allow the user to write via ftp there, i just symlink it back and make a virtual host in my httpd.conf. the virtual host settings say /var/www/html/domainfolder, but its actually a symlink back to /home/domain/public_html. this setup, also make the url of syed.domain.com quite easy to configure as well.
Thank you for this help, but I do not know how to create symlinks, However I am in favor in learning. Can you show me how to do this or give a link where the tutorial is quite easy to follow. Surry for buggin you.
Thanks
the link can be anyname you like.ill actually use mine as an example. here is my web directory:
Code:
[root@demeter html]# ll
total 16
lrwxrwxrwx 1 root root 30 Jun 25 09:29 dfwlanparty.org -> /home/dfwlanparty/public_html/
drwxrwxr-x 2 root root 4096 Oct 15 2004 dlpadmin
-rw-r--r-- 1 root root 593 Jun 17 19:10 index.html
drwxrwxr-x 5 root root 4096 Oct 21 2004 logs
drwxrwxr-x 5 root root 4096 Oct 15 2004 sys
lrwxrwxrwx 1 root root 31 Jun 20 10:13 z71silverado.com -> /home/z71silverado/public_html/
as you can see, i have 2 sites listed, that point back to homedirs, with symlinks. to create them, the least confusing way, would be to cd to /var/www/html, and specify the folder you want linked and the link name right there. the command i gave, would have been like this:
it would not syncronize... it would be the exact folder being served by apache.
to enable userdirs, check /etc/httpd/conf/httpd.conf. it might also be called homedirs, i cant recall off the top of my head, but its one or the other.
right, but you want to be sure you symlink your /home/syed/public_html and not /home/syed, or you will serve your homedir, and not the webpages you want.
study my above example again, and see how the --> after a name under /var/www/html points to a folder listed under a /home/syed. i wish the colors were like they were in bash. in my example, the symlinks in real life will show up as cyan, and make it easy to tell which ones are links, and which are real folders and files.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.