Sunday, March 27, 2011

About Apache several common application examples and analysis

A. how to give each user set up separate home? default settings, you need in your user home directory create a public_html directory, and then put your page file in the directory, enter the http://servername/~username access, but please note the following: 1. login as root, modify the user's home directory permissions (# chmod705/home/username), let other people have the right to enter that directory browsing.

2. login with your user name, create a public_html directory, ensure that the directory has the correct permissions for others to enter. 3.Apache default home page is index.html, index.htm is not, you can change the line in the file/etc/mime.types like below. Text/htmlhtmltm then Apache will read your index.htm file 4. the user's own home directory under the directory it is best to create permissions are set to 0700 to ensure that others cannot access. B. how to set up virtual hosts? 1. assuming that a server IP to 192.168.11.2, to a virtual one IPaddress, plus 192.168.11.4 following lines to/etc/rc.d/rc.local/sbin/ifconfigeth0: 0192.168.11.4/sbin/routeadd-host192.168.11.4et0: 0 2. Add the following line to the/home/httpd/conf/httpd.con VirtualHost192.168.11.4 (this line is the ">) ServerAdminyour_email_address DocumentRoot/home/httpd/foldername ServerName virtualservername ErrorLog/var/log/httpd/foldername/error.log TransferLog/var/log/httpd/access_log/foldername/VirtualHost (this line is the" >) 3. If your LAN has a DNS server, plus the corresponding item 192.168.11.4---> virtualservername C. how to use Apache to password-protect a directory. default, can be delegated in a directory with a .htaccess file, like this: AuthNamestuf AuthTypeBasic AuthUserFile/etc/.userpasswd requirevalid-user in order to give the user user1 into the access, use # htpasswd-c/etc/password assigned to user1 .userpasswduser1. D. how to send a directory share out available browser access? as/home/ftp/pub/1. Add the following line to change the default file type/home/httpd/conf/srm.confAlias/pub/home/ftp/pub/2., change in behavior:/home/httpd/conf/srm.conf DefaultTypeapplication/octet-stream3. restart Apache./etc/rc.d/init.d/httpdrestar

No comments:

Post a Comment