development:system:ubuntu
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
development:system:ubuntu [2024/08/06 06:59] – created - external edit 127.0.0.1 | development:system:ubuntu [2025/01/01 07:51] (current) – [certbot] tungnt | ||
---|---|---|---|
Line 320: | Line 320: | ||
$ ssh tungnt@ip_vps -p 2200 | $ ssh tungnt@ip_vps -p 2200 | ||
</ | </ | ||
+ | |||
+ | https:// | ||
====== Cài đặt ứng dụng ====== | ====== Cài đặt ứng dụng ====== | ||
Line 421: | Line 423: | ||
$ php -v | $ php -v | ||
$ php --ini | $ php --ini | ||
+ | php -m | grep opentelemetry | ||
</ | </ | ||
Line 462: | Line 465: | ||
</ | </ | ||
+ | **Install Multiple PHP Versions:** | ||
+ | |||
+ | <code bash> | ||
+ | apt-get install software-properties-common gnupg2 -y | ||
+ | |||
+ | add-apt-repository ppa: | ||
+ | |||
+ | apt-get update -y | ||
+ | |||
+ | apt-get install php7.2 php7.2-fpm php7.2-cli -y | ||
+ | apt-get install php7.4 php7.4-fpm php7.4-cli -y | ||
+ | apt-get install php8.0 php8.0-fpm php8.0-cli -y | ||
+ | apt-get install php8.1 php8.1-fpm php8.1-cli -y | ||
+ | |||
+ | php --version | ||
+ | |||
+ | # Set the Default PHP Version: | ||
+ | update-alternatives --config php | ||
+ | </ | ||
+ | |||
+ | **Switch Between Multiple PHP Versions with Nginx:** | ||
+ | |||
+ | <file conf nginx.conf> | ||
+ | server { | ||
+ | listen | ||
+ | |||
+ | server_name | ||
+ | |||
+ | root / | ||
+ | |||
+ | index index.php index.html index.htm; | ||
+ | |||
+ | location / { | ||
+ | try_files $uri $uri/ / | ||
+ | } | ||
+ | |||
+ | location ~ \.php$ { | ||
+ | try_files | ||
+ | fastcgi_pass | ||
+ | fastcgi_index | ||
+ | fastcgi_param | ||
+ | include | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | fastcgi_pass | ||
+ | |||
+ | <file conf / | ||
+ | ... | ||
+ | ; The address on which to accept FastCGI requests. | ||
+ | ; Valid syntaxes are: | ||
+ | ; ' | ||
+ | ; a specific port; | ||
+ | ; ' | ||
+ | ; a specific port; | ||
+ | ; ' | ||
+ | ; (IPv6 and IPv4-mapped) on a specific port; | ||
+ | ; '/ | ||
+ | ; Note: This value is mandatory. | ||
+ | listen = 127.0.0.1: | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | https:// | ||
===== Supervisor ===== | ===== Supervisor ===== | ||
Line 505: | Line 573: | ||
| | ||
| | ||
+ | |||
+ | wget \ | ||
+ | -e robots=off \ | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
</ | </ | ||
Line 620: | Line 700: | ||
< | < | ||
certbot --nginx -d test.com -d www.test.com | certbot --nginx -d test.com -d www.test.com | ||
+ | |||
+ | sudo certbot delete | ||
</ | </ | ||
Line 625: | Line 707: | ||
https:// | https:// | ||
+ | |||
+ | ====== Bash file example ====== | ||
+ | |||
+ | <file sh gc> | ||
+ | #! /bin/bash | ||
+ | |||
+ | MESSAGE=" | ||
+ | |||
+ | sudo git commit -am " | ||
+ | </ | ||
+ | |||
+ | ====== Cron job ====== | ||
+ | |||
+ | **Cấu trúc:** minute hour day_of_month month day_of_week command_to_run | ||
+ | |||
+ | **Trong đó:** | ||
+ | - minute: 0-59 | ||
+ | - hour: 0-23 | ||
+ | - Field Allowed Values | ||
+ | - minute 0-59 | ||
+ | - hour 0-23 | ||
+ | - day_of_month: | ||
+ | - month: 1-12 or JAN-DEC | ||
+ | - day_of_week: | ||
+ | - command_to_run: | ||
+ | |||
+ | **Ví dụ:** | ||
+ | |||
+ | <code bash> | ||
+ | 30 17 * * 2 curl http:// | ||
+ | </ | ||
+ | |||
+ | **Cài đặt job: | ||
+ | |||
+ | <code bash> | ||
+ | crontab -e | ||
+ | |||
+ | # Here are some more examples of how to use cron’s scheduling component: | ||
+ | * * * * * - Run the command every minute. | ||
+ | 12 * * * * - Run the command 12 minutes after every hour. | ||
+ | 0,15,30,45 * * * * - Run the command every 15 minutes. | ||
+ | */15 * * * * - Run the command every 15 minutes. | ||
+ | 0 4 * * * - Run the command every day at 4:00 AM. | ||
+ | 0 4 * * 2-4 - Run the command every Tuesday, Wednesday, and Thursday at 4:00 AM. | ||
+ | 20,40 */8 * 7-12 * - Run the command on the 20th and 40th minute of every 8th hour every day of the last 6 months of the year. | ||
+ | </ | ||
+ | |||
+ | **Tham khảo:** https:// |
development/system/ubuntu.1722927590.txt.gz · Last modified: 2024/08/06 06:59 by 127.0.0.1