CẤU HÌNH WEB SERVER TRÊN CENTOS 6.0

Post new topic   Reply to topic

View previous topic View next topic Go down

CẤU HÌNH WEB SERVER TRÊN CENTOS 6.0

Post  chantroitinhoc on Mon Sep 19, 2011 1:54 am

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

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 1:07 am; edited 6 times in total

chantroitinhoc
Admin

Posts: 126
Join date: 2008-01-16

View user profile http://chantroitinhoc.niceboard.net

Back to top Go down

Cài Đặt PHP

Post  chantroitinhoc on Mon Sep 19, 2011 2:50 am

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

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!

chantroitinhoc
Admin

Posts: 126
Join date: 2008-01-16

View user profile http://chantroitinhoc.niceboard.net

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You can reply to topics in this forum