Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

set directory owner, group, and permissions on *nix machine

Execute the following commands via the command line:

sudo chgrp -R _www /Users/user_dir/target_dir
sudo chmod -R ug=rwx /Users/user_dir/target_dir
sudo find /Users/user_dir/target_dir -type d -exec chmod 2770 {} \;
sudo find /Users/user_dir/target_dir -type f -exec chmod ug=rwx {} \;
The first command sets the group to _www recursively.
The second command sets the owner and group permissions to rwx recursively.
The third command makes it so all new directories get created with the correct permissions (i.e. 2770).
The fourth command makes it so all new files get created with the correct permissions (i.e. rwx).

This post is simply a guide. Your values will differ depending on your desired outcome. In your case you may want to set only the group permissions or only the owner permissions (as opposed to both as illustrated in this post). The actual permission values you end up setting may differ too.
Continue Reading

enable or disable an apache virtual host?

To enable an apache virtual host run the following command:
sudo a2ensite example.com
To disable an apache virtual host run the following command:
sudo a2dissite example.com
Both of the examples above assume you're interested in enabling/disabling the site configured via the following file:
/etc/apache2/sites-available/example.com
Lastly, if you're interested in learning more about the a2ensite/a2dissite command, checkout the following notes:
#This manual page documents briefly the a2ensite and a2dissite commands.

#a2ensite is a script that enables the specified site (which contains a
#<VirtualHost> block) within the apache2 configuration. It does this by
#creating symlinks within /etc/apache2/sites-enabled. Likewise,
#a2dissite disables a site by removing those symlinks. It is not an
#error to enable a site which is already enabled, or to disable one
#which is already disabled.

#The default site is handled specially: The resulting symlink will be
#called 000-default in order to be loaded first.
Continue Reading