Web Applications Chatchai J...
Transcript of Web Applications Chatchai J...
![Page 1: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/1.jpg)
Linux Server Admin
Web Applications
Chatchai J
2013-12-25(updated: 2013-01-14 2013-01-16)
![Page 2: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/2.jpg)
Application on Web
● Using Web as User Interface● Example
– Database : phpmyadmin● php, mysql
– Mail : web mail● roundcube● squirrelmail
– Weblog – blog● wordpress
![Page 3: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/3.jpg)
phpmyadmin
● ตติดตตตั้ง$ sudo aptget install phpmyadmin
● config
– เลลือก apache2 เปป็น Web Server
– admin password สสสำหรตบ mysql server (root)
– password สสสำหรตบ phpmyadmin
● LEAVE IT BLANK (phpmyadmin จะ gen random password ใหห)
![Page 4: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/4.jpg)
phpmyadmin (ตต่อ)
● ทดสอบททที่ URL
http://www.domain.com/phpmyadminhttp://172.30.160.xx/phpmyadmin
● login โดยใชห admin account ของ mysql
– Login: root
– Password: ********
● ใชหงสำนไดหแลหว!
![Page 5: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/5.jpg)
ในกรณทททที่มทปตญหสำ➔ apache web server ทสสำงสำนอยต่ยู่หรลือเปลต่สำ?
$ ps uaxw | grep apache
ถหสำไมต่ แกหปตญหสำ config ของ apache กต่อน$ sudo apachectl configtest
ดยู่วต่สำมท error ททที่ใหนแลหวแกหไขใหหถยู่กตหอง $ sudo apachectl restart
![Page 6: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/6.jpg)
ในกรณทททที่มทปตญหสำ (ตต่อ)
➔ เปติ ด webbrowser (firefox, lynx, epiphany, chromium-browser)
$ firefox localhost
➔ ควรททที่จะใชหงสำนไดห, ถหสำไมต่ไดห ยกมลือถสำม→
➔ เปลทที่ยนจสำก localhost เปป็น ip address
* ตรวจสอบใหหแนต่ใจวต่สำ IP address ของเครลืที่อง VM คลืออะไร กต่อนเปติ ด$ firefox http://172.30.160.XX
➔ ควรททที่จะใชหงสำนไดห, ถหสำไมต่ไดห ยกมลือถสำม→
![Page 7: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/7.jpg)
ในกรณทททที่มทปตญหสำ (ตต่อ)
➔ เปติ ดโดยใชห domain name (www.domain.com) $ firefox http://www.domain.com
➔ ถหสำมทปตญหสำ ใหหตรวจสอบ DNS$ host t a www.domain.com localhost$ host t a www.domain.com 172.30.0.85$ host t a www.domain.com lsasvr.coe.psu.ac.th$ host t a www.domain.com
➔ ททุกคสสำสตที่งควรจะใหหคสสำตอบเดทยวกตน คลือ IP Address ของ เครลืที่อง VM ของคทุณในตอนนทตั้
![Page 8: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/8.jpg)
ถหสำ lookup address แลหวมทปตญหสำ● ไฟลล์ /etc/resolv.conf ของ VM (และของ host) จะตหองมทขหอมยู่ลดตงนทตั้
domain coe.psu.ac.thsearch coe.psu.ac.thnameserver 172.30.0.85
– Dhcp Server ควรจะกสสำหนดใหหแลหว สสสำหรตบปท นทตั้ (Dec 2013)● Note: Domain update at lsa-svr.coe.psu.ac.th
– VM จะตหองสต่ง notification ไปยตง lsa-svr.coe.psu.ac.th เพลืที่อ register
domain ของตตวเองใหห lsa-svr รหยู่จตก– update serial ใน ZONE file แลหวใชห rndc reload
![Page 9: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/9.jpg)
ปตญหสำของ DNS
$ host t a www.domain.com localhost
● ถหสำไมต่สสำมสำรถ resolve ไดหแสดงวต่สำ named server บน VM มทปตญหสำ
● ตรวจสอบวต่สำ named run อยต่ยู่หรลือเปลต่สำ?
$ ps auxw | grep named
● ถหสำไมต่มทใหห start bind9
$ sudo service bind9 start
![Page 10: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/10.jpg)
ปตญหสำของ DNS (ตต่อ)
● ถหสำ start named ไมต่ไดห ใหหตรวจสอบ config ของ named
$ namedcheckconf
$ namedcheckconf z
● ทตตั้งสองคสสำสตที่ง จะตหองไมต่มท error ถหสำมท ใหหแกหไขใหหถยู่กตหอง ถหสำยตงแกหไมต่ไดห ยกมลือถสำม→
$ sudo service bind9 restart
$ sudo rndc reload
● แลหวตรวจสอบ log ใน /var/log/syslog
$ sudo grep named /var/log/syslog | tail 25
● จะตหองมทขหอควสำม “running” หรลือ “reload configuration succeeded”
● มทขหอควสำม “zone domain.com/IN: sending notified (serial xxxxxxxxxx)”
![Page 11: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/11.jpg)
ปตญหสำของ DNS (ตต่อ)
$ host t a www.domain.com 172.30.0.85$ host t a www.domain.com lsasvr.coe.psu.ac.th
● ถหสำไมต่สสำมสำรถ resolve ไดหแสดงวต่สำ ขหอมยู่ลของ zone มทปตญหสำ● ใน zone ไฟลล์ /var/cache/bind/master/domain.com จะตหองมท
– record ของ NS 2 record
$ORIGIN domain.com.
IN NS lsasvr.coe.psu.ac.th.
IN NS ns.domain.com.
– Note: บรรทตด $ORIGIN มทควสำมสสสำคตญ– และมท A record ของ ns.domain.com ซซที่งมท IP Address เปป็นของ VM ในขณะนทตั้ns IN A 172.30.160.xx
![Page 12: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/12.jpg)
ปตญหสำของ DNS (ตต่อ)
● ททุกครตตั้งททที่แกหไข zone ไฟลล์ ใหห update serial
ของ SOA เสมอ● หลตงจสำกแกหไขเสรป็จ reload config แลหวตรวจสอบอทกครตตั้ง
● ถหสำยตงใชหงสำนไมต่ไดห ยกมลือถสำม→
![Page 13: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/13.jpg)
กลตบมสำททที่ www
● ถซงตอนนทตั้ควรททที่จะใชหงสำน$ firefox http://www.domain.com
● จสำก VM (และจสำก host ถหสำ nameserver เปป็น 172.30.0.85) ไดหแลหว
● ตต่อไปเปป็นกสำรเขหสำถซง phpmyadmin
$ firefox http://www.domain.com/phpmyadmin
![Page 14: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/14.jpg)
phpmyadmin
● ถหสำเขหสำถซง http://www.domain.com ไดหแตต่ http://www.domain.com/phpmyadmin ยตงไมต่ไดห
● จะเปป็นปตญหสำททที่ config ของ phpmyadmin● ตรวจสอบดยู่วต่สำมทไฟลล์ /etc/apache2/conf.d/phpmyadmin.conf หรลือเปลต่สำ$ ls l /etc/apache2/conf.d | grep phpmyadmin
● ควรจะมทไฟลล์ config ใน /etc/phpmyadmin/apache.conf อยต่ยู่แลหว$ ls l /etc/phpmyadmin/apache.conf
– ถหสำไมต่มท ใหหตติดตตตั้ง phpmyadmin ใหมต่
![Page 15: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/15.jpg)
phpmyadmin
● สรหสำง link จสำก /etc/phpmyadmin/apache.conf ไปไวหใน /etc/apache2/conf.d$ cd /etc/apache2/conf.d$ sudo ln sf /etc/phpmyadmin/apache.conf phpmyadmin.conf
● restart apache2 ใหมต่ ททุกครตตั้งหลตงจสำกมทกสำรเปลทที่ยนแปลง config$ sudo service apache2 restart
![Page 16: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/16.jpg)
phpmyadmin
● ตติดตตตั้ง phpmyadmin ใหมต่$ sudo aptget purge phpmyadmin
$ sudo rm rvf /etc/phpmyadmin
$ sudo aptget install phpmyadmin
![Page 17: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/17.jpg)
ปตญหสำสสสำหรตบ phpmyadmin
● ใชหงสำนผต่สำนทสำง web interface
● สต่งขหอมยู่ลแบบ plain text
● login/password สสสำหรตบ database ซซที่งสสำมสำรถ แกหไขขหอมยู่ลใดๆกป็ไดหในฐสำนขหอมยู่ลทตตั้งหมด
● ไมต่ควร ใชหงสำนแบบนทตั้● วติธทกสำรแกหไข เขหสำรหตสกสำรรตบ/สต่งขหอมยู่ล โดยใชห https แทน
http
![Page 18: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/18.jpg)
เขหสำรหตส HTTP
● ใชห https
● ssl เปป็น module ของ apache2
● สสำมสำรถ enable โดยใชห “a2enmod ssl”
$ sudo a2enmod ssl
$ sudo service apache2 restart
![Page 19: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/19.jpg)
เขหสำรหตส HTTP (ตต่อ)
● config ของ apache สสสำหรตบ ssl แยกออกมสำจสำก default ซซที่งไมต่ไดหเขหสำรหตส
● ดยู่ไฟลล์ใน /etc/apache2/sites-available และ /etc/sites-
enabled
● สสำมสำรถ enable โดยใชหคสสำสตที่ง a2ensite
$ sudo a2ensite defaultssl
$ sudo service apache2 restart
![Page 20: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/20.jpg)
https connection
● สสำมสำรถ connect โดยใชหhttps://www.domain.com
– จะตหอง trust key ททที่สรหสำงขซตั้นมสำกต่อน เพรสำะเปป็นแบบ self-signed
● ใชหงสำนไดหแลหว?
https://www.domain.com/phpmyadmin
แลหวhttp://www.domain.com/phpmyadmin ลต่ะ?
![Page 21: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/21.jpg)
อตนตรสำยจสำก phpmyadmin
● มท zombie bot จสสำนวนมสำกใชหวติธทกสำร bruteforce
attack อยต่ยู่จสสำนวนมสำก● กสำรปห องกตน
– mysql administrator password MUST secure
– update/upgrade phpmyadmin อยต่ยู่เสมอ– ซต่อนมตนไวหหลตง virtualhost อลืที่น
![Page 22: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/22.jpg)
เพติที่ม name ตต่อไปนทตั้ใน Zone file
● shell● webmail● pma (phpmyadmin)● blog
pma IN A 172.30.160.xxx
shell IN A 172.30.160.xxx
...
● เพลืที่อใหหสสำมสำรถใชหชลืที่อ pma.domain.com (และอลืที่นๆ) ไดห
![Page 23: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/23.jpg)
virtualhost config
● เรสำจะใชห https://pma.domain.com
สสสำหรตบกสำรเขหสำถซง phpmyadmin เทต่สำนตตั้นไมต่สสำมสำรถเขหสำจสำกทสำงอลืที่นไดห
● ดยู่ตตวอยต่สำงกสำร config virtualhost ของ https://www.domain.com จสำก /etc/apache2/sites-available/default-ssl
![Page 24: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/24.jpg)
virtual host
● เรติที่มจสำก http://pma.mydomain.com ใหหเขหสำถซง phpmyadmin
● ใชห VirtualHost และระบทุ ServerName
$ sudo cp /etc/phpmyadmin/apache.conf \ /etc/apache2/sitesavailable/phpmyadmin$ sudo edit /etc/apache2/sitesavailable/phpmyadmin
![Page 25: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/25.jpg)
phpmyadmin
<VirtualHost pma.domain.com:80>
# Alias /phpmyadmin /usr/share/phpmyadminDocumentRoot /usr/share/phpmyadminServerName pma.domain.com…</Directory></VirtualHost>
เพติที่ม config ในสต่วนสทนสตั้สำเงติน$ sudo a2ensite phpmyadmin$ sudo service apache2 restart
![Page 26: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/26.jpg)
https://pma.domain.com
<VirtualHost pma.domain.com:443>
DocumentRoot /usr/share/phpmyadminServerName pma.domain.com…</Directory>SSLEngine onSSLCertificateFile /etc/ssl/certs/sslcertsnakeoil.pemSSLCertificateKeyFile /etc/ssl/private/sslcertsnakeoil.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">SSLOptions +StdEnvVars
</FilesMatch>
</VirtualHost>
![Page 27: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/27.jpg)
Access to phpmyadmin
● เพลืที่อไมต่ใหหเขหสำถซง phpmyadmin ไดหจสำกhttp://www.domain.com/phpmyadmin
https://www.domain.com/phpmyadmin
http://pma.domain.com
● เขหสำถซงไดหเฉพสำะhttps://pma.domain.com
![Page 28: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/28.jpg)
Access to phpmyadmin
$ rm f /etc/apache2/conf.d/phpmyadmin
$ sudo edit /etc/apache2/sitesenabled/phpmyadmin
$ sudo service apache2 restart
NameVirtualHost pma.domain.com:80<VirtualHost pma.domain.com:80>
ServerName pma.domain.comRedirect / https://pma.domain.com
</VirtualHost>
NameVirtualHost pma.domain.com:443<VirtualHost pma.domain.com:443>…</VirtualHost>
![Page 29: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/29.jpg)
Config for www
● สลืบเนลืที่องจสำก default config ซซที่งกสสำหนดคต่สำ virtualhost เปป็น <VirtualHost *:80> ใน 000-default
และสสสำหรตบ https เปป็น <VirtualHost *:443> ใน default-ssl
จะทสสำใหหกสำรใชหงสำน VirtualHost อลืที่นๆ มทปตญหสำ
![Page 30: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/30.jpg)
● ดตงนตตั้นใหหสรหสำง config สสสำหรตบhttp://www.domain.com
และhttps://www.domain.com
โดยสรหสำงเปป็น config เฉพสำะสสสำหรตบ Virtual Host
นตตั้นๆโดยเฉพสำะ
![Page 31: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/31.jpg)
$ cd /etc/apache2/sitesavailable$ sudo cp default www$ sudo cp defaultssl wwwssl
● และแกหไข www เปลทที่ยน<VirtualHost *:80>
เปป็น<VirtualHost www.domain.com:80>
![Page 32: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/32.jpg)
● และแกหไข www-ssl เปลทที่ยน<VirtualHost *:443>
เปป็น<VirtualHost www.domain.com:443>
● และ comment บรรทตดNameVirtualHost *:80
● ใน /etc/apache2/ports.conf
![Page 33: Web Applications Chatchai J 2013-12-25fivedots.coe.psu.ac.th/Software.coe/241-478/Ch11-Web-App.pdf · ในกรณทททที่มทปตญหสำ (ตต่อ) เปติด](https://reader033.fdocument.pub/reader033/viewer/2022042122/5e9c531e28059c00f8122324/html5/thumbnails/33.jpg)
● Disable 000-default และ default-ssl
● และ enable www กตบ www-ssl
$ sudo a2ensite www wwwssl$ sudo a2dissite default defaultssl
● และ restart apache2
$ sudo service apache2 restart