CẤU HÌNH WEB SERVER TRÊN CENTOS 6.0
Page 1 of 1
CẤU HÌNH WEB SERVER TRÊN CENTOS 6.0
1. Cài đặt httpd:
[root@www ~]# yum -y install httpd
2. Xoá trang welcome:
[root@www ~]# rm -f /etc/httpd/conf.d/welcome.conf
3. Xoá trang default error:
[root@www ~]# rm -f /var/www/error/noindex.html
4. Cấu hình httpd:
[root@www ~]# vi /etc/httpd/conf/httpd.conf
Lưu tập tin httpd và khởi động dịch vụ httpd
[root@www ~]# /etc/rc.d/init.d/httpd start
Cho httpd khởi động cùng hệ thống
[root@www ~]# chkconfig httpd on
5. Tạo một trang web để test:
[root@www ~]# vi /var/www/html/index.html
Sau đó bạn mở trình duyệt web và truy cập web site nội bộ sẽ hiển thị nội dung trang web bạn vừa tạo là thành công!
@: Các bạn có thể tham khảo ở Video Configuring CentOS 6.0 Web Server để hiểu rõ phần cấu hình.
[root@www ~]# yum -y install httpd
2. Xoá trang welcome:
[root@www ~]# rm -f /etc/httpd/conf.d/welcome.conf
3. Xoá trang default error:
[root@www ~]# rm -f /var/www/error/noindex.html
4. Cấu hình httpd:
[root@www ~]# vi /etc/httpd/conf/httpd.conf
- Code:
# line 76: change to ON
KeepAlive On
# line 262: Admin's address
ServerAdmin root@ispace.com
# line 276: change to your server's name
ServerName www.ispace.com:80
# line 402: add file name that it can access only with directory's name
DirectoryIndex index.html index.php
# line 536: change
ServerSignature Off
Lưu tập tin httpd và khởi động dịch vụ httpd
[root@www ~]# /etc/rc.d/init.d/httpd start
Cho httpd khởi động cùng hệ thống
[root@www ~]# chkconfig httpd on
5. Tạo một trang web để test:
[root@www ~]# vi /var/www/html/index.html
- Code:
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Truong Cao Dang Nghe CNTT iSPACE than chao cac ban sinh vien.
</div>
</body>
</html>
Sau đó bạn mở trình duyệt web và truy cập web site nội bộ sẽ hiển thị nội dung trang web bạn vừa tạo là thành công!
@: Các bạn có thể tham khảo ở Video Configuring CentOS 6.0 Web Server để hiểu rõ phần cấu hình.
Last edited by chantroitinhoc on Sat Sep 24, 2011 8:07 am; edited 6 times in total
Cài Đặt PHP
1. Cài đặt PHP:
[root@www ~]# yum -y install php php-mbstring php-pear
[root@www ~]# /etc/rc.d/init.d/httpd restart
2. Tạo trang web php để test:
[root@www ~]# vi /var/www/html/index.php
Lưu nội dung trang web php rồi mở trình duyệt để duyệt trang web php bạn vừa tạo:
http://www.ispace.com/index.php
xuất hiện được ngày tháng năm của hệ thống là thành công!
[root@www ~]# yum -y install php php-mbstring php-pear
[root@www ~]# /etc/rc.d/init.d/httpd restart
2. Tạo trang web php để test:
[root@www ~]# vi /var/www/html/index.php
- Code:
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
<?php
print Date("Y/m/d");
?>
</div>
</body>
</html>
Lưu nội dung trang web php rồi mở trình duyệt để duyệt trang web php bạn vừa tạo:
http://www.ispace.com/index.php
xuất hiện được ngày tháng năm của hệ thống là thành công!
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|