1. Trang chủ
  2. » Luận Văn - Báo Cáo

Báo cáo tổng hợp tuần 7 cài Đặt và cấu hình web server trên centos 7

26 0 0
Tài liệu được quét OCR, nội dung có thể không chính xác
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Cài Đặt Và Cấu Hình Web Server Trên Centos 7
Tác giả Vừ Hoàng Quỳnh Như
Trường học sgu
Thể loại báo cáo
Định dạng
Số trang 26
Dung lượng 6,86 MB

Nội dung

| Oh Z5 DM OM Oo et 1 eo me Virtual Machine Settings Library | 9 Type here to search | JSIdrSE [Opiates = © My Computer Tu mm ïetosdo [ Windows Server 3 Processors 1 @ connect at power

Trang 1

Võ Hoàng Quỳnh Như _ 3119410294

Báo cáo tổng hợp tuân 7

Cài đặt và câu hình Web server trên Centos 7

Luu y rang, trước khi thực hiện cài đặt web server, ta phải đảm bảo DNS server hoàn chính và hoạt động được Muôn có website mang tén mién nao, DNS cua domain đó phải trỏ về IP cua may web server (da thực hành ở tuân 2)

Trang 2

vonhu@dns:/home/vonhu

- n

File Edit View Search Terminal Help

[root@sgu vonhu]# nslookup

> 192.168.1.1

1.1.168.192.in-addr.arpa name = sgu.edu.vn

1.1.168.192.in-addr.arpa name = vnlab.com.vn

>

Cài đặt Httpd

Đề thực hiện web server, ta phải cài Apache server

Lưu ý: phai dam bao may minh co mang (vao Setting -> Network Adapter -> NAT)

File Edit View VM Tehe— won | BE |) Oh Z5 DM OM Oo et 1) eo me

Virtual Machine Settings

Library

| 9 Type here to search | JSIdrSE [Opiates

= © My Computer Tu mm ïetosdo

[) Windows Server (3 Processors 1 @ connect at power on

EEi Windows XP Proft [\Hard Disk (SCSI) 20 GB /

IE Clone of Windows A Network connection

I) Clone of Window, ©) Bridged: Connected directly to the physical network

=} USB Controller Fresent \ Replicate physical network connection state

cj) Sound Card ES rrner Auto detect Present

(I display Auto detect CQvHost-only: A private network shared with the host

Custom: Specific virtual network

Trang 3

root@sgu:~ - ao x

File Edit View Search Terminal Help

[root@sgu ~]# yum install httpd

Loaded plugins: fastestmirror, Langpacks

File Edit View Search Terminal Help

Running transaction check

Running transaction test

Transaction test succeeded

httpd-tools.x86 64 0:2.4.6-97.el17.centos.1 mailcap.noarch 0:2.1.41-2.e17

Trang 4

cp /etc/httpd/conf/httpd.conf ~/httpd.conf.bak

Ta tao thu muc chita website:

Vi du: ta sé tạo thư mục ở folder /var/www/html:

vonhu@dns:/home/vonhu = n x

File Edit View Search Terminal Help

[root@sgu vonhu]# mkdir -p /var/www/htmL/vntLab com vn

[root@sgu vonhu]# mkdir -p /var/www/htmL/sgu.edu.vn

[root@sgu vonhu]# ls /var/ww/htmL

sgu.edu.vn vnlab.com.vn

[root@sgu vonhu]#

Ta phải gán quyền cho đề website hoạt động bình thường (khi ma qua client khác vẫn truy cập vào website được)

chown -R apache:apache /var/www/html/vnlab.com.vn

chown -R apache:apache /var/www/html/sgu.edu.vn

Ngoài ra chmod 755 dé dam bao mọi ngudi CÓ thé xem duoc website

chmod 755 /var/www

chmod 755 /var/www/html

[root@sgu vonhu]# chown -R apache:apache /var/www/html/vnlab.com.vn

[root@sgu vonhu]# chown -R apache:apache /var/www/html/sgu.edu.vn

[root@sgu vonhu]# chmod 755 /var/www

[root@sgu vonhu]# chmod 755 /var/www/html

Cai dat virtual host (céng mạng để truy cập website):

nano /etc/httpd/conf/httpd.conf

Trang 5

vonhu@dns:/home/vonhu = n x

File Edit View Search Terminal Help

GNU nano 2.3.1 File: /etc/httpd/conf/httpd conf Modified

# files This usually improves server performance, but must

# be turned off when serving from networked-mounted

# filesystems or if support for these functions is otherwise

# broken on your system

# Defaults if commented: EnableMMAP On, EnableSendfile Off

thém doan code nay

ae Get Help jẤU Write0ut Read File @ Prev Page @% Cut Text @@ Cur Pos

ey Exit @J Justify Where Is @Y Next Page @Y UnCut Text@j To Spell

Tao virtual host cho cac websites:

Luu y rang, cac file virtual host phải có dạng *.conf Ngoài ra, tại mỗi website ta nên tạo

1 virtual host cho dé quan ly

nano /etc/httpd/conf.d/vnlab.com.vn.conf

Sau đó thêm đoạn code cầu hình như sau:

Trang 6

vonhu@dns:/home/vonhu _— n x

File Edit View Search Terminal Help

Í[ GNU nano 2.3.1 Fite: /etc/httpd/conf.d/vnLab com vn conf

9 Get Help a) WriteOut Read File Wi Prev Page @s Cut Text @e@ Cur Pos

ei Exit a) Justify Where Is Mj Next Page @! UnCut Text ij To Spell

Tương tự với sgu.edu.vn, thêm đoạn code như sau:

vonhu@dns:/home/vonhu - BH X

File Edit View Search Terminal Help

GNU nano 2.3.1 File: /etc/httpd/conf.d/sgu.edu.vn.conf

ae Get Help a) WriteOut i Read File mi Prev Page NA Cut Text me Cur Pos

@s Exit @) Justify Where Is i) Next Page @! UnCut Text ij To Spell

Trang 7

File Edit View Search Terminal Help

GNU nano 2.3.1 File: /var/www/html/vnlab.com.vn/index.html

<h1> Xin chao! Day ta website vnLab.com.vn </h1>

Sau khi tạo xong, để đảm bảo ồn định ta gán quyền cho ñle index.html như sau: chmod +x /var/www/html/vnlab.com.vn/index.html

Tương tự, ta làm cho sgu.edu.vn

nano /var/www/html/sgu.edu vn/index.html

vonhu@dns:/home/vonhu - n x

File Edit View Search Terminal Help

FiLe: /var/www/htmt/sgu.edu.vn/index.htmL

<h1> Xin chao! Day la website sgu.edu.vn </h1>

Sau khi tạo xong, để đảm bảo ồn định ta gán quyền cho ñle index.html như sau: chmod +x /var/www/html/sgu.edu vn/index.html

Sau khi thực hién xong, ta phai start httpd

Trang 8

Thiết lập IP tĩnh cho server

Kiểm tra DNS server (ở đây sử dụng DNS server với dia chi 192.168.1.1)

#* Applications Places Firefox Web Browser Mon 03:44 & $4 ©

Trang 9

© Network Connections

? | > Control Panel > Et tO Static : Lx |

Q Ethernet0 Properties Organize ¥ Disable this network devic [ Networking | = Y IW 9

te Ethemet0

Unidentified network

4 Intei(R) 82574L Gigabit Network General |

arch Ne ork Connections #

Yotain DNS server address automatically (@) Use the following DNS server addresses Preferred DNS server: 192.168 1 1

litem 1 item selected L_

Events |validate settings upon ext Events

ROLES AND SERVER GROUPS Noles | SENEr GICUpE } | Setvers tot

igi apps 1 § DHCP 1 | @ DNS ¡| | g ElcandSomae 1

® Manageahiity ® Manageability @® Manageability ® Manageatility

events Events Events Events

Services Services Services Services

Performance Performance Performance Performance

Trang 10

Select server roles WN+'56E80322CD tech.vn

Before You Beain Select one or more roles to install on the selected server

Installation Type Roles Description

Server Selection — - - = = a Web Server (IS) provides a reliable,

|_| Application Server manageable, and scalable Web

| DHCP e application infrastructure Features

¥v ) L_] Fax Server

b jMi Fileand Storage Services (2 of 12 installed) | Hyper-V f4 | x Ww gem x Network Policy and Access Services tich vao d ti n hà nh Print and Document Services `

Remote Access ca | Remote Desktop Services

Tai day chon Add Features

Sau d6 chon Next dén khi Install

Trang 11

Installation progress WN-158E03220D.techvn

View installation progress

@ Feature installation

Installation started on WIN-IS9EB0322QD.tech.vn

Management Tools

IS Management Console Web Server Common HTTP Features

EC |] Default Document

Directory Browsing HTTP Errors Static Content Health and Diagnostics

You can close this wizard without interrupting running tasks View task progress or open this

© page again by clicking Notifications in the command bar, and then Task Details

< Previous Next > | Instal | Cancel Export configuration settings

Tao tép, file html twong wng cho it.net

Vao 6 C, tao thu muc webserver dé chira file cau hinh cho website

Trang 12

© > [b> This PC > Local Disk (C) + webserver > itnet | v G| | Search itnet ˆ

è Favorites Name + Date modified Type Size

BB Desktop | index.txt 11/15/2021 7:45 PM Text Document 1KB

lạ Downloads

=} Recent places

WM This PC File Edit Format View Help |

<h1> Xin chao! Day la website IT.net </hi> | ^

© x |# + This PC » Local Disk (C:) » webserver > itnet v o| Search it.net e |

Ỷ Eavorites Name ˆ Date modified Type Size

BB Desktop [Eì index html 11/15/2021 7:45 PM HTML Document 1KB

& DNS Name Type Data Timestamp

4 ij WIN-I59EB0322QD (same as parent folder) Start of Authority ( [1], win-i89eb0322q static

4 Forward Lookup Zo [same as parent folder) Name Server (NS) wu Static

v Gi data.org © (same as parent folder) Hast (A)

Trang 13

File Action View Help

& DNS Name Type Data

4 ij WIN-I59EB0322QD |! (same as parent folder) Start of Authority ( _ [10], win-i59eb0322

4 =3 Forward Lookup Zo “| (same as parent folder) Name Server (NS) win-i59eb0322qd.tec

» Gi data.org E]192.168.1.1 Pointer (PTR) win-i59eb0322qd.tec

: 5 telecom £]192168.1.1 Pointer (PTR) itnet

a itnet El 192.168.1.10 Pointer (PTR) win-i59eb0322qd.tec

4 Reverse Lookup Zor =) 192.168.1.100 Pointer (PTR) win-vl7e7pfvi7itech

Sĩ 1.168.192.in-addil| E] 192.168.1.150 Pointer (PTR) www.itnet

Tạo đường dẫn trên IIS

Server Manager * IIS ~@ 1 P Me tới view nếp

tổ DNS Add Roles and Features

Shut Down Local Server

Configure Windows Automatic Feedback

Internet Information Services (IIS) Manager

Trang 14

1 Nhan chuét phai vao Site, chon Add website

§&_ Switch to Content View

Cấu hình cho site như bên dưới:

1 Site name nên đặt theo host đã cài đặt ở DNS

2 Physical path: chọn đường dẫn đến tệp chứa file index.html tương ứng

B1: đặt tên cho site

itnet [net | | Select |

Select a directory for the application

B2: chọn vào đường dân đã tạo

Start Website immediately

Trang 15

@ |e › WIN-I59EB0322QD > Sites > itnet > wx @

File View Help

@- Hine @ Default Document :

W The file ‘index.htm!

P Use this feature to specify the default file(s) to return when a client does not request a specific file Set default documents in exists in the current

order of priority directory Itis

you move this file to

the top of the list to

meres đẩy lên trên cùng để ưu tiên _ zz==m= meted file được chạy trước Add

in {i Features View |i Content View

Configuration: ‘tnet’ web.config

Kiém tra DNS it.net co dang hoat dong

=

Microsoft Windows [Version 6.3.9600]

(c) 2013 Microsoft Corporation All rights reserved

C:\Users\Administrator>ping it.net

Pinging it.net [192.168.1.1] with 32 bytes of data:

Replu from 192.168.1.1: bụtesz32 time<1ms TTL=128

Reply from 192.168.1.1: bytes=32 time<ims TTL=128

Reply from 192.168.1.1: bytes=32 time<ims TTL=128

Reply from 192.168.1.1: bytes=32 time<ims TTL=128

Ping statistics for 192.168.1.1:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = Oms, Maximum = Oms, Average = Oms

iC: \Users\Administrator>

Trang 16

Sau đó ta sé test thir trén browser Explore cua Windows va đây là thành quả:

Cai dat Web Server(IIS) da được cài đặt ở bước trên

Cài đặt phần mềm Microsoft Web Platform dé cai dat PHP va MySQL

(lưu ý: phải đảm bảo máy có mạng đề download phần mềm từ browser xuống)

BB web Platferm Installer: The Ol)

‹ CG © @ hitps/Awwn-microsatt.comveb/downloads/plattorm asp: #8 9

8% Microsoft carch alt oF HS,NET Sign Inv

IIS Home M nage Downloads Learn Reference solutions v 3logs Forums

All Downloads CommunllyCortibutsd Dowrloads Microsoft Supported Downloads — Free Web Platlorrn Installer

Home » Downloads » Microsoit Supported Downloads +» Web Platform Installer

Web Platform Installer

2 Tiss « Microsutt Supported Download ar view aédtioual dowaleade

Trang 17

° Web Platform Installer 5.1 -|o| x

¥ Web Platform Installer 5.1

Tiếp theo, tim kiém cai goi “MySQL Windows 5.1”, nhan Add -> Install đề tiễn hành cai

dat

Trang 18

Name Released Install

MySQL Windows 5.5 9/9/2015

Windows Azure Pack MySQL Extension 11/1/2016

SQL Server Migration Assistant for MySQL 9/25/2017

MvSOI Cannector/Net 9/2/2015 Add

Tién hanh dat tao méi password (luu y phai can than khi dat, nén dat mat khau dé nho dé

sau này khi thao tac voi Database can dén no)

Trang 19

— Virtual Machine Settings

Hardware Options

Device Summary Device status

#ElMemory 2B fcenected (Od Processors 1 Bi connect at power on

E—3}Hard 0Isk (SCS1) 50 G8

@au ì Network connection

R ©) Bridged: Connected directly to the physical network (S)uss Convoller rae Replicate physical network connection state f4? Sound Card Auto detect

Printer Present |AT: Used to share the host's IP address

(Ipisplay Auto detect jost-only: A private network shared with the host

O custom: Specific virtual network

You can get IP settings assigned automatically if your network

supports this capability Otherwise, you need to ask your network

administrator for the appropriate IP settings

() Obtain an IP address automatically

(@) Use the following IP address:

Trang 20

Ở đây, mình sẽ tạo ra một folder “Web server” va bé vao source code php cia minh

@ @ x + À > ThisPC > Local Disk (C:)) » Web Server > sgu.edu.vn r| v G| Search squ.edu.vn Pp

& Local Disk (C) ¬

Be + customer 11/21/2021 6:26PM File folder

Truy cap MySQL Command Line dé thém Database cho Website

1 Nhap password cua root luc cai đặt ở trên đê đăng nhập

2 Xem danh sách database hiện có băng “show databases;”

Trang 21

Your MySQL connection id is 3

Server version: 5.1.73-community MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates All rights reserved

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates Other names may be trademarks of their respective

Ouners

Type 'help;' or '\h' for help Type '\c' to clear the current input statement

[ ‘| wem danh séch datebase

3 Tao | database moi cé tén market bang “create database market;”

4 Truy cap database market bang “use market”

5 Tién hanh import CSDL cho database bang “source

C:\Users\vonhu\Desktop\market.sql”

Lay duong dan dén file sql

Trang 22

marketsql MMe 5.92 KB (6.063 bytes) lấy đường dân

Size on disk: 8.00 KB (8.192 bytes)

Created: Today, November 21, 2021 1 minute ago

Modified Today, November 21, 2021, 1 minute ago

Accessed: Today, November 21, 2021 9:06:04 PM

Attributes: | |Read-only [ |Hidden Advanced |

[ 0K | | Cancel |

mysql>|create database market; tao Detaioase

)

Queru ÚK7“T“FðW“ãffe€feØ “(0:00 sec

mysql> use market uy cap database

Database changed

Query , © rows affected (0.00 sec)

Query , © rows affected (0.00 sec)

Queru , © rows affected (0.00 sec)

Queru , 9 rows affected (0.00 sec)

Query , © rows affected (0.00 sec)

ERROR 1115 (42000): Unknown character set: ‘utf8mb4'

Query OK, 9 rows affected (0.01 sec)

Query OK, 4 rows affected (0.00 sec)

Records: Duplicates: 0 Warnings: 0

Ngày đăng: 27/11/2024, 17:46

w