By default, you need to create the directory public_Html in your user's home directory, then put all your web files in this directory, type in http: // servername / ~ username, but please pay attention to the following point:
1. Login as root, modify the user home directory permissions (# chmod 705 / home / username), so that other people have the right to enter the directory browsing.
2. Log in with your own username, create a public_html directory, and ensure that the directory also has the correct permissions for others to enter.
3. Apache default homepage file is index.html, not index.htm, you can change the line in the /etc/mime.types file like below.
text / html html htm
Then Apache will read your index.htm file 4. The user's own directory created in the home directory is best to set the permissions to 0700, to ensure that other people can not access.
B. How to set up virtual hosting?
1. Suppose a server IP 192.168.11.2, to virtual another IP address 192.168.11.4, then add the following line to /etc/rc.d/rc.local
/ sbin / ifconfig eth0: 0 192.168.11.4 / sbin / route add -host 192.168.11.4 eth0: 0
2. Add the following line to /home/httpd/conf/httpd.conf
VirtualHost 192.168.11.4 (this line has <>)
ServerAdmin your_email_address
DocumentRoot / home / httpd / foldername
ServerName virtualservername
ErrorLog /var/log/httpd/foldername/error.log
TransferLog / var / log / httpd / foldername / Access_log / VirtualHost (this line has <>)
3. If you have a DNS server on your LAN, add the corresponding entry 192.168.11.4 ---> virtualservername
C. How to use Apache to a directory password protected?
By default, a file, .htaccess, can be placed in a directory like this:
AuthName stuff
AuthType Basic
AuthUserFile /etc/.userpasswd
require valid-user
To give access to user user1, # htpasswd -c /etc/.userpasswd user1 is assigned a password for user1.
D. How to share a list of browser access? Such as / home / FTP / pub /
1. Add the following line to /home/httpd/conf/srm.confAlias / pub / home / ftp / pub / 2. Change the default file type, change /home/httpd/conf/srm.conf a line:
DefaultType application / octet-stream 3. Restart Apache. /etc/rc.d/init.d/httpd restar