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
vi /etc/php.ini
: date.timezone = Asia/Taipei :
vi /etc/my.cnf.d/mariadb-server.cnf
在 [mysqld] 段落加入
innodb_file_per_table=1 lower_case_table_names=0
systemctl enable mariadb systemctl restart mariadb
mysql -u root
CREATE USER 'root'@'192.168.11.%' IDENTIFIED BY 'xxxxxxxx'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.11.%'; FLUSH PRIVILEGES; exit
vi /etc/nginx/conf.d/web.conf
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; } }
如果只要執行一個網站, 就移去 nginx.conf 內的預設的 server 段落
vi /etc/nginx/nginx.conf
: 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; :
systemctl enable --now nginx systemctl enable --now php-fpm