Apache chạy bình thường với thư mục /var/www/html. Nhưng em mún chạy các trang web trong thư mục /home/user/public_html nên đã config như sau:
File htttpd.conf
Code:
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
# See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
#
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
#UserDir disable
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disable" line above, and uncomment
# the following line instead:
#
UserDir public_html
</IfModule>
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
SeLinux
Code:
Last login: Tue May 6 10:04:40 2008 from 192.168.1.2
[root@localhost ~]# getsebool -a|grep httpd
allow_httpd_anon_write --> off
allow_httpd_dbus_avahi --> off
allow_httpd_mod_auth_pam --> off
allow_httpd_sys_script_anon_write --> off
httpd_builtin_scripting --> on
httpd_can_network_connect --> on
httpd_can_network_connect_db --> on
httpd_can_network_relay --> off
httpd_can_sendmail --> off
httpd_enable_cgi --> on
httpd_enable_ftp_server --> off
httpd_enable_homedirs --> on << cái này em set on mà
httpd_ssi_exec --> off
httpd_tty_comm --> on
httpd_unified --> on
httpd_use_cifs --> off
httpd_use_nfs --> off
[root@localhost ~]#
Sau đó em tạo thư mục public_html trong /home/user và chmod nó là 755. Rùi copy các file *.html vào đó.
Nhưng khi type http://192.168.1.3/user/index.html vào FF nó lại báo lỗi
Code:
Not Found
The requested URL /user/index.html was not found on this server.
Apache/2.2.6 (Fedora) Server at 192.168.1.3 Port 80
còn http://192.168.1.3/index.html lại chạy bình thường
Các anh làm ơn chỉ giúp em cách cấu hình để chạy dc các file trong userDir như mấy site trên mạng ấy.
thanks các anh nhìu