差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版 前次修改
tech:pve-ct-centos8-php-nginx-mariadb [2020/12/06 08:38] jonathantech:pve-ct-centos8-php-nginx-mariadb [2020/12/06 12:01] (目前版本) jonathan
行 1: 行 1:
 +====== 建立 PVE CT-CentOS8 + php7.3 + nginx + MariaDB 樣板 ======
  
 +  * 建立環境 : 
 +    * PVE 6.3-2
 +    * Cores 1 / Memory 512MB / Swap 512MB / Root Disk 8G
 +    * CentOS 8 Template - centos-8-default_20191016_amd64.tar.xz
 +  * 建立 CT 之後, 先進行 [[tech/pve-ct-centos7]]
 +  * 重新開機後登入進行安裝 php7.3 + nginx + MariaDB <cli>
 +dnf -y install epel-release
 +dnf module reset php
 +dnf module enable php:7.3
 +dnf install bash-completion cronie fping git ImageMagick mariadb-server mtr net-snmp net-snmp-utils nginx nmap php-fpm php-cli php-common php-curl php-gd php-json php-mbstring php-process php-snmp php-xml php-zip php-mysqlnd python3 python3-PyMySQL python3-redis python3-memcached python3-pip rrdtool unzip
 +</cli>
 +  * 設定 PHP 時區<cli>
 +vi /etc/php.ini
 +</cli><file>
 +:
 +date.timezone = Asia/Taipei
 +:
 +</file>
 +  * 設定 MariaDB <cli>
 +vi /etc/my.cnf.d/mariadb-server.cnf
 +</cli>在 [mysqld] 段落加入 <file>
 +innodb_file_per_table=1
 +lower_case_table_names=0
 +</file><cli>
 +systemctl enable mariadb
 +systemctl restart mariadb
 +</cli>
 +  * 建立透過 192.168.11.xxx 網段可登入的 root 帳號, 密碼 xxxxxxxx<cli>
 +mysql -u root
 +</cli><code sql>
 +CREATE USER 'root'@'192.168.11.%' IDENTIFIED BY 'xxxxxxxx';
 +GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.11.%';
 +FLUSH PRIVILEGES;
 +exit
 +</code>
 +  * 設定 php-fpm <cli>
 +
 +</cli>
 +  * 設定 nginx web Exp. test.ichiayi.com <cli>
 +vi /etc/nginx/conf.d/web.conf
 +</cli><file>
 +server {
 + listen      80 default_server;
 + server_name test.ichiayi.com;
 + root        /var/www/html;
 + index       index.php;
 +
 + charset utf-8;
 + gzip on;
 + gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
 + location / {
 +  try_files $uri $uri/ /index.php?$query_string;
 + }
 + location ~ [^/]\.php(/|$) {
 +  fastcgi_pass unix:/run/php-fpm/www.sock;
 +  fastcgi_split_path_info ^(.+\.php)(/.+)$;
 +  include fastcgi.conf;
 + }
 + location ~ /\.(?!well-known).* {
 +  deny all;
 + }
 +}
 +</file>如果只要執行一個網站, 就移去 nginx.conf 內的預設的 server 段落<cli>
 +vi /etc/nginx/nginx.conf
 +</cli><file>
 +:
 +    include /etc/nginx/conf.d/*.conf;
 +
 +#    server {
 +#        listen       80 default_server;
 +#        listen       [::]:80 default_server;
 +#        server_name  _;
 +#        root         /usr/share/nginx/html;
 +#
 +#        # Load configuration files for the default server block.
 +#        include /etc/nginx/default.d/*.conf;
 +:
 +</file><cli>
 +systemctl enable --now nginx
 +systemctl enable --now php-fpm
 +</cli>
  • tech/pve-ct-centos8-php-nginx-mariadb.txt
  • 上一次變更: 2020/12/06 12:01
  • jonathan