SlideShare a Scribd company logo
Linux Server Admin



    Web Server

    Chatchai J
    2013-01-09
Web Servers
●   Application จำำนวนมำกบน Computer ย้ำยขึ้นไปอยู่บน Web

●   กำรให้บริกำรบน Web (Web Services) คูอนข้ำงซับซ้อน

●   ในร่ปแบบที่ ซับซ้อนน้อยที่สดคือกำรให้บริกำรแบบ static files
                               ุ

●   … โดยใช้ Web Server
Web Servers
●   บน Linux มีให้เลือกใช้จำำนวนมำก

    –   ขึ้นอยู่กับลักษณะกำรใช้งำน

●   Web Server ทีเป็ นทีนิยม
                 ่      ่
    –   apache2
    –   nginx
    –   lighttpd
    –   boa (สำำหรับระบบ embedded)
Apache2 Web Server
●   เป็ น Server ที่นิยมมำกที่สดสำำหรับกำรใช้งำนทั่วๆไป
                               ุ

●   กำรติดตั้งเพื่อใช้งำน มักจะไมูใช้โดดเดี่ยว แตูจะใช้งำนรูวมกับ
    ตัวอื่นๆ
    –   MySQL Database Server
    –   PHP5 Language
    –   etc …
●   ไมูได้เป็ นสูวนหนึ่งของ Web Server แตูจะสะดวกกวูำ
    ถ้ำจะพ่ดถึง และ ยกตัวอยูำงไปด้วยกันเลย
LAMP
●   L – Linux
●   A – Apache
●   M – MySQL
●   P – php, perl, python, ruby, ...
ติดตั้ง Apache Server
    $ sudo apt­get install apache2 mysql­server php5

●   หลังจำกติดตั้งแล้วให้ใช้ web browser ตรวจ
    สอบโดยเปิ ดไปที่ http://$IP โดยที่ $IP คือ IP
    Address ของเครื่อง VM

●   ควรจะเห็นข้อควำมวูำ “It work!”
Apache Web Server

 It works!
 This is the default web page for this server.
 The web server software is running but no content has been added, yet.




ปรบมือให้กบตัวเอง
          ั
คุณติดตั้ง Web Server เสร็จแล้ว
Web Content
●   จะเก็บอยู่ใน /var/www

●   ให้ทดลองแก้ไขไฟล์ index.html และ reload
    page
●   สร้ำง sub directory และไฟล์ html ใน directory
    ยูอยนั้น
ใช้งำน PHP
●   สร้ำงไฟล์ /var/www/index.php
    <?php
            phpinfo();
    ?>




●   reload page, เปลี่ยน code
    <?php
            $today = date("Y­m­d H:i:s");
            echo "Today is $today<br>";
    ?>
User Dir
●   กำรอนุญำตให้ user บนเครื่องสำมำรถใช้ public_html
    สำำหรับเป็ น home page ได้

●   จะต้องใช้ userdir module ซึ่งโดย default ไมูได้ enable
    เอำไว้ จะต้อง enable โดยกำรใช้
    $ sudo a2enmod userdir
    $ sudo service apache2 restart
●   ทดสอบโดยใช้ http://$IP/~$user
php ใน user home page
●   จะต้องแก้ไข
      /etc/apache2/mods-enabled/php5.conf

●   โดย comment ในสูวนของ
    <ifModule mod_userdir.c>
    …
    </IfModule>

●   แล้ว reload config

More Related Content

PDF
Ch11 web-app
PDF
ความหมายของโปรแกรมคอมพิวเตอร์
PDF
ความหมายของโปรแกรมคอมพิวเตอร์
PDF
VBoxManage tutorial
PDF
Red5 workshop
PPT
Server2Go เว็บพกพาตัวจริง
PDF
คำศัพท์
PDF
Ch15 elastic hosts-svradmin
Ch11 web-app
ความหมายของโปรแกรมคอมพิวเตอร์
ความหมายของโปรแกรมคอมพิวเตอร์
VBoxManage tutorial
Red5 workshop
Server2Go เว็บพกพาตัวจริง
คำศัพท์
Ch15 elastic hosts-svradmin

Viewers also liked (15)

PDF
Ch17 secure-password
PDF
CompTIA Linux+
PDF
Ch12 web-app-part2
PDF
Editors for-linux
ODP
Ch01 administrators-tasks
PDF
Virtualbox networking
PPTX
Learn docker in 90 minutes
PDF
Ch09 mail-systems-part2
PDF
Shipping Applications to Production in Containers with Docker
PDF
A Gentle Introduction To Docker And All Things Containers
PPTX
Why Docker
PPTX
Docker introduction
PDF
Docker from A to Z, including Swarm and OCCS
PDF
Study: The Future of VR, AR and Self-Driving Cars
PDF
The Future of Everything
Ch17 secure-password
CompTIA Linux+
Ch12 web-app-part2
Editors for-linux
Ch01 administrators-tasks
Virtualbox networking
Learn docker in 90 minutes
Ch09 mail-systems-part2
Shipping Applications to Production in Containers with Docker
A Gentle Introduction To Docker And All Things Containers
Why Docker
Docker introduction
Docker from A to Z, including Swarm and OCCS
Study: The Future of VR, AR and Self-Driving Cars
The Future of Everything
Ad

Similar to Ch10 web servers (20)

PPT
การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 05
PDF
HTML PHP MySQL สำหรับเว็บโปรแกรมเมอร์มือใหม่
KEY
คู่มือการติดตั้ง Wordpress บน AppServ
PDF
Wordpress
PPTX
หน่วยที่ 1 รู้จักกับ joomla!
PPTX
หน่วยที่ 1 รู้จักกับ joomla!
PPT
เริ่มต้นกับ PHP
DOC
งานครูปลาม์
PDF
20121102 joomla2-5
PDF
Wordpress 3.5 -install-appserv
PPS
Tc on new2
ODP
Ch04 linux-hosting-vps
PDF
PDF
คู่มือการติดตั้ง Cent os
PDF
Introduction to PHP programming
PDF
Development stack with WTserver
PDF
joomla-2-5-install-appserv
PDF
Web Server Stack with WPИ-XM
PDF
คู่มือ Joomla
PDF
การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 05
HTML PHP MySQL สำหรับเว็บโปรแกรมเมอร์มือใหม่
คู่มือการติดตั้ง Wordpress บน AppServ
Wordpress
หน่วยที่ 1 รู้จักกับ joomla!
หน่วยที่ 1 รู้จักกับ joomla!
เริ่มต้นกับ PHP
งานครูปลาม์
20121102 joomla2-5
Wordpress 3.5 -install-appserv
Tc on new2
Ch04 linux-hosting-vps
คู่มือการติดตั้ง Cent os
Introduction to PHP programming
Development stack with WTserver
joomla-2-5-install-appserv
Web Server Stack with WPИ-XM
คู่มือ Joomla
Ad

More from Chatchai Jantaraprim (6)

PDF
Ch08 mail-systems
PDF
Ch07 bind9-part2
PDF
ODP
Ch05 name-services
ODP
Ch03 domain-registration
ODP
Ch02 administrators-tasks
Ch08 mail-systems
Ch07 bind9-part2
Ch05 name-services
Ch03 domain-registration
Ch02 administrators-tasks

Ch10 web servers

  • 1. Linux Server Admin Web Server Chatchai J 2013-01-09
  • 2. Web Servers ● Application จำำนวนมำกบน Computer ย้ำยขึ้นไปอยู่บน Web ● กำรให้บริกำรบน Web (Web Services) คูอนข้ำงซับซ้อน ● ในร่ปแบบที่ ซับซ้อนน้อยที่สดคือกำรให้บริกำรแบบ static files ุ ● … โดยใช้ Web Server
  • 3. Web Servers ● บน Linux มีให้เลือกใช้จำำนวนมำก – ขึ้นอยู่กับลักษณะกำรใช้งำน ● Web Server ทีเป็ นทีนิยม ่ ่ – apache2 – nginx – lighttpd – boa (สำำหรับระบบ embedded)
  • 4. Apache2 Web Server ● เป็ น Server ที่นิยมมำกที่สดสำำหรับกำรใช้งำนทั่วๆไป ุ ● กำรติดตั้งเพื่อใช้งำน มักจะไมูใช้โดดเดี่ยว แตูจะใช้งำนรูวมกับ ตัวอื่นๆ – MySQL Database Server – PHP5 Language – etc … ● ไมูได้เป็ นสูวนหนึ่งของ Web Server แตูจะสะดวกกวูำ ถ้ำจะพ่ดถึง และ ยกตัวอยูำงไปด้วยกันเลย
  • 5. LAMP ● L – Linux ● A – Apache ● M – MySQL ● P – php, perl, python, ruby, ...
  • 6. ติดตั้ง Apache Server $ sudo apt­get install apache2 mysql­server php5 ● หลังจำกติดตั้งแล้วให้ใช้ web browser ตรวจ สอบโดยเปิ ดไปที่ http://$IP โดยที่ $IP คือ IP Address ของเครื่อง VM ● ควรจะเห็นข้อควำมวูำ “It work!”
  • 7. Apache Web Server It works! This is the default web page for this server. The web server software is running but no content has been added, yet. ปรบมือให้กบตัวเอง ั คุณติดตั้ง Web Server เสร็จแล้ว
  • 8. Web Content ● จะเก็บอยู่ใน /var/www ● ให้ทดลองแก้ไขไฟล์ index.html และ reload page ● สร้ำง sub directory และไฟล์ html ใน directory ยูอยนั้น
  • 9. ใช้งำน PHP ● สร้ำงไฟล์ /var/www/index.php <?php         phpinfo(); ?> ● reload page, เปลี่ยน code <?php         $today = date("Y­m­d H:i:s");         echo "Today is $today<br>"; ?>
  • 10. User Dir ● กำรอนุญำตให้ user บนเครื่องสำมำรถใช้ public_html สำำหรับเป็ น home page ได้ ● จะต้องใช้ userdir module ซึ่งโดย default ไมูได้ enable เอำไว้ จะต้อง enable โดยกำรใช้ $ sudo a2enmod userdir $ sudo service apache2 restart ● ทดสอบโดยใช้ http://$IP/~$user
  • 11. php ใน user home page ● จะต้องแก้ไข /etc/apache2/mods-enabled/php5.conf ● โดย comment ในสูวนของ <ifModule mod_userdir.c> … </IfModule> ● แล้ว reload config