Apache Config on Ubuntu Server :: Manual add new site
Apache Tuning from How To Optimize Apache
Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 MinSpareServers 5 MaxSpareServers 10 StartServers 5 MaxClients 150 MaxRequestsPerChild 0
Create new user how
sudo adduser userName
Make user sudo how
sudo adduser userName sudo
MySQL Configuration
- Increrase memory size for MySQL Server using nano /etc/my.cnf and add/change value ตามรายละเอียด
innodbbufferpoolsize = 2048M innodblogfilesize = 512M maxconnections = 500 keybuffer_size = 512M
PHP Config
Set timezone to Asia/Bangkok
nano /etc/php/7.4/apache2/php.ini
date.timezone = Asia/Bangkok
Add CNAME domain.com to ppi.psu.ac.th
Add new site to Apache
cd /etc/apache2/sites-available nano sites-available/doname.com.conf
<VirtualHost *:80> ServerName domain.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html/domain.com </VirtualHost> <VirtualHost *:80> ServerName www.domain.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html/domain.com </VirtualHost> <IfModule mod_ssl.c> <VirtualHost _default_:443> ServerName domain.com ServerAdmin webmaster@localhost DocumentRoot /home/user/domains/domain.com </VirtualHost> <VirtualHost _default_:443> ServerName www.domain.com ServerAdmin webmaster@localhost DocumentRoot /home/user/domains/domain.com </VirtualHost> </IfModule>
cd /etc/apache2/sites-enabled ln -s ../sites-available/domain.com.conf domain.com.conf
Restart Apache
systemctl restart apache2
Restart MySql
systemctl restart mysql
INSTALL Let's Encrypt
1. ติดตั้งด้วย snap ดูรายละเอียดได้ที่ Certbot instructions
snap install --classic certbot ln -s /snap/bin/certbot /usr/bin/certbot certbot --apache certbot certonly --apache certbot renew --dry-run
2. ติดตั้งด้วย apt-get จาก repo
apt-add-repository -r ppa:certbot/certbot
After that, the following commands do not generate any errors:
apt update apt-get update apt install python3-certbot-apache
certbot --apache -d domain.com -d www.domain.com
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=domain.com
IMPORTANT NOTES:
Congratulations! Your certificate and chain have been saved at:
- /etc/letsencrypt/live/domain.com/fullchain.pem
- Your key file has been saved at:
- /etc/letsencrypt/live/domain.com/privkey.pem
- Your cert will expire on 2021-01-08. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew all of your certificates, run "certbot renew"
To test the renewal process, you can do a dry run with certbot:
sudo certbot renew --dry-run
Correct way to completely remove issued certificate(s) for a domain
certbot delete --cert-name domain.com
Copy file from another server using SSH
Alternatively, you could mount the myserver's filesystem over SSH with sshfs. This may be too much hassle for a one-off need, but convenient if you do this sort of thing often.
mkdir myserver sshfs -p 22 domain.com:/path/ myserver wget -O ~/myserver/path/to/remote/destination http://www.example.com/whatever rsync -trv myserver/src/path/ dest/path/ umount myserver
rsync in background
nohup rsync -trv myserver/src/path/ dest/path/ &
Dump Database
mysqldump -u [username] -p [database-you-want-to-dump] > [path-to-place-data-dump.sql] /usr/local/mysql/bin/mysqldump -u [username] -p [database-you-want-to-dump] > [path-to-place-data-dump.sql]
Ways to Flush DNS Cache on Mac OSx
sudo killall -HUP mDNSResponder
WhoIs LookUp
nslookup -type=ns softganz.com
Setup Time Sync
ติดตั้ง
apt-get install ntp
แก้ไข config
nano /etc/ntp.conf
เปลี่ยน server เป็น
server 1.th.pool.ntp.org server 0.asia.pool.ntp.org server 2.asia.pool.ntp.org server clock.nectec.or.th
Restart
service ntpd restart
หรือ
service ntp restart
ที่มา
- Certbot instructions
- How To Secure Apache with Let's Encrypt on Ubuntu 18.04
- E: The repository 'http://ppa.launchpad.net/certbot/certbot/ubuntu focal Release' does not have a Release file
- How To Use SSHFS to Mount Remote File Systems Over SSH
- How to wget a file to a remote machine over SSH?
- Correct way to completely remove issued certificate(s) for a domain
- How to increase memory size for MySQL Server
- MySQL Performance Tuning Settings
- HOWTO: Sync เวลาไม่ควรใช้ ntpdate ควรใช้ ntpd แทน
Relate topics
- ddosify : Load Test - ไม่ผ่าน
- macOS 12 Monterey: Web Server Setup/Apache/MariaDB/PHP Multiple Versions
- Ubuntu Server Installation
- อีกที : macOS 11.0 Big Sur Apache/MiriaDB/PHP Setup
- Ubuntu Web Server Setup
- Check and Repair Hardisk
- Install AFP Share Server Protocal on Linux
- เช็คเงื่อนไข url request ใน .htaccess
- วิธีการติดตั้ง Let’s Encrypt automated free SSL certificate
- Linux Server Tools
- Make Macbook Pro to be Web Server
- พบบั๊ก GHOST ใน glibc ความร้ายแรงระดับสูง กระทบลินุกซ์รุ่นเก่าจำนวนมาก
- Server Setup : การกำหนดสิทธิ์ Root ให้กับ user บน Ubuntu 14.04
- Setup FTP Server under Ubuntu/Debian
- ย้ายบ้านให้ MySql
- Debian : ปิดการตรวจสอบฮาร์ดดิสอัตโนมัติขณะเปิดเครื่อง
- Dabian bandwidth monitoring
- อีกครั้ง - Make Ubuntu 16.04 to be a web server (LAMP)
- Directadmin เข้า port 2222 ไม่ได้
- How to update Directadmin by SSH