SlideShare a Scribd company logo
1 of 11
Download to read offline
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

Viewers also liked

Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutesLarry Cai
 
Shipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with DockerShipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with DockerJérôme Petazzoni
 
A Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things ContainersA Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things ContainersJérôme Petazzoni
 
Why Docker
Why DockerWhy Docker
Why DockerdotCloud
 
Docker introduction
Docker introductionDocker introduction
Docker introductiondotCloud
 
Docker from A to Z, including Swarm and OCCS
Docker from A to Z, including Swarm and OCCSDocker from A to Z, including Swarm and OCCS
Docker from A to Z, including Swarm and OCCSFrank Munz
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
 
The Future of Everything
The Future of EverythingThe Future of Everything
The Future of EverythingCharbel Zeaiter
 

Viewers also liked (15)

Ch17 secure-password
Ch17 secure-passwordCh17 secure-password
Ch17 secure-password
 
CompTIA Linux+
CompTIA Linux+CompTIA Linux+
CompTIA Linux+
 
Ch12 web-app-part2
Ch12 web-app-part2Ch12 web-app-part2
Ch12 web-app-part2
 
Editors for-linux
Editors for-linuxEditors for-linux
Editors for-linux
 
Ch01 administrators-tasks
Ch01 administrators-tasksCh01 administrators-tasks
Ch01 administrators-tasks
 
Virtualbox networking
Virtualbox networkingVirtualbox networking
Virtualbox networking
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutes
 
Ch09 mail-systems-part2
Ch09 mail-systems-part2Ch09 mail-systems-part2
Ch09 mail-systems-part2
 
Shipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with DockerShipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with Docker
 
A Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things ContainersA Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things Containers
 
Why Docker
Why DockerWhy Docker
Why Docker
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Docker from A to Z, including Swarm and OCCS
Docker from A to Z, including Swarm and OCCSDocker from A to Z, including Swarm and OCCS
Docker from A to Z, including Swarm and OCCS
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 
The Future of Everything
The Future of EverythingThe Future of Everything
The Future of Everything
 

Similar to Ch10 web servers

01 ความรู้เกี่ยวกับการ web programming
01 ความรู้เกี่ยวกับการ web programming01 ความรู้เกี่ยวกับการ web programming
01 ความรู้เกี่ยวกับการ web programmingsupatra178
 
1. ความรู้เกี่ยวกับการ web programming
1. ความรู้เกี่ยวกับการ web programming1. ความรู้เกี่ยวกับการ web programming
1. ความรู้เกี่ยวกับการ web programminghello8421
 
การเขียนโปรแกรมบนเว็บ
การเขียนโปรแกรมบนเว็บการเขียนโปรแกรมบนเว็บ
การเขียนโปรแกรมบนเว็บKhon Kaen University
 
Portable Moodle : Moodle & Server2Go
Portable Moodle  : Moodle & Server2GoPortable Moodle  : Moodle & Server2Go
Portable Moodle : Moodle & Server2GoBoonlert Aroonpiboon
 
งานครูปลาม์
งานครูปลาม์งานครูปลาม์
งานครูปลาม์0908067327
 
OAI-PMH with Drupal + XAMPP Portable + PKP OHS
OAI-PMH with Drupal + XAMPP Portable + PKP OHSOAI-PMH with Drupal + XAMPP Portable + PKP OHS
OAI-PMH with Drupal + XAMPP Portable + PKP OHSBoonlert Aroonpiboon
 
การเขียนโปรแกรมบนเว็บ
การเขียนโปรแกรมบนเว็บการเขียนโปรแกรมบนเว็บ
การเขียนโปรแกรมบนเว็บKhon Kaen University
 
HTML PHP MySQL สำหรับเว็บโปรแกรมเมอร์มือใหม่
HTML PHP MySQL สำหรับเว็บโปรแกรมเมอร์มือใหม่HTML PHP MySQL สำหรับเว็บโปรแกรมเมอร์มือใหม่
HTML PHP MySQL สำหรับเว็บโปรแกรมเมอร์มือใหม่Manop Kongoon
 
Joomla Talk ครั้งที่ 6 Back to basic Joomla and Template
Joomla Talk ครั้งที่ 6  Back to basic Joomla and TemplateJoomla Talk ครั้งที่ 6  Back to basic Joomla and Template
Joomla Talk ครั้งที่ 6 Back to basic Joomla and TemplateAkarawuth Tamrareang
 

Similar to Ch10 web servers (20)

01 ความรู้เกี่ยวกับการ web programming
01 ความรู้เกี่ยวกับการ web programming01 ความรู้เกี่ยวกับการ web programming
01 ความรู้เกี่ยวกับการ web programming
 
1. ความรู้เกี่ยวกับการ web programming
1. ความรู้เกี่ยวกับการ web programming1. ความรู้เกี่ยวกับการ web programming
1. ความรู้เกี่ยวกับการ web programming
 
การเขียนโปรแกรมบนเว็บ
การเขียนโปรแกรมบนเว็บการเขียนโปรแกรมบนเว็บ
การเขียนโปรแกรมบนเว็บ
 
Portable Moodle : Moodle & Server2Go
Portable Moodle  : Moodle & Server2GoPortable Moodle  : Moodle & Server2Go
Portable Moodle : Moodle & Server2Go
 
Introduction to PHP programming
Introduction to PHP programmingIntroduction to PHP programming
Introduction to PHP programming
 
งานครูปลาม์
งานครูปลาม์งานครูปลาม์
งานครูปลาม์
 
Php
PhpPhp
Php
 
OAI-PMH with Drupal + XAMPP Portable + PKP OHS
OAI-PMH with Drupal + XAMPP Portable + PKP OHSOAI-PMH with Drupal + XAMPP Portable + PKP OHS
OAI-PMH with Drupal + XAMPP Portable + PKP OHS
 
Ch02 administrators-tasks
Ch02 administrators-tasksCh02 administrators-tasks
Ch02 administrators-tasks
 
Joomla CMS
Joomla CMSJoomla CMS
Joomla CMS
 
Ch07 bind9-part2
Ch07 bind9-part2Ch07 bind9-part2
Ch07 bind9-part2
 
Managing Big Data with Apache Hadoop.pdf
Managing Big Data with Apache Hadoop.pdfManaging Big Data with Apache Hadoop.pdf
Managing Big Data with Apache Hadoop.pdf
 
การเขียนโปรแกรมบนเว็บ
การเขียนโปรแกรมบนเว็บการเขียนโปรแกรมบนเว็บ
การเขียนโปรแกรมบนเว็บ
 
PHP&Dreamweaver 1-4
PHP&Dreamweaver 1-4PHP&Dreamweaver 1-4
PHP&Dreamweaver 1-4
 
HTML PHP MySQL สำหรับเว็บโปรแกรมเมอร์มือใหม่
HTML PHP MySQL สำหรับเว็บโปรแกรมเมอร์มือใหม่HTML PHP MySQL สำหรับเว็บโปรแกรมเมอร์มือใหม่
HTML PHP MySQL สำหรับเว็บโปรแกรมเมอร์มือใหม่
 
Build Website with Joomla! 3.3
Build Website with Joomla! 3.3Build Website with Joomla! 3.3
Build Website with Joomla! 3.3
 
Joomla Talk ครั้งที่ 6 Back to basic Joomla and Template
Joomla Talk ครั้งที่ 6  Back to basic Joomla and TemplateJoomla Talk ครั้งที่ 6  Back to basic Joomla and Template
Joomla Talk ครั้งที่ 6 Back to basic Joomla and Template
 
php5new
php5newphp5new
php5new
 
Basic Kong API Gateway
Basic Kong API GatewayBasic Kong API Gateway
Basic Kong API Gateway
 
Iis7on microsoftwindows2008
Iis7on microsoftwindows2008Iis7on microsoftwindows2008
Iis7on microsoftwindows2008
 

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