archlinux 安装lemp

pacman -Syyu
pacman -S nginx
systemctl start nginx
systemctl enable nginx

main configuration file is /etc/nginx/nginx.conf

pacman -S mysql

初始化数据文件夹:

mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

systemctl enable mysqld
systemctl start mysqld

mysql_secure_installation

pacman -S php-fpm php-gd php-sqlite php-imagick

新建 /etc/nginx/php_fastcgi.conf

location ~ .php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
root /usr/share/nginx/html;
include fastcgi.conf;
}

在 nginx.conf 里 server{} 里面添加

include /etc/nginx/php_fastcgi.conf;

systemctl start php-fpm
systemctl enable php-fpm

编辑 /etc/php/php.ini 文件,取消注释下列行开启mysql,vim使用/查找

extension=mysqli
extension=pdo_mysql

编辑 /etc/nginx/nginx.conf 文件,添加 index.php

index index.html index.htm index.php;

mysql创建新用户:

CREATE USER ‘monty’@’localhost’ IDENTIFIED BY ‘some_pass’;
GRANT ALL PRIVILEGES ON mydb.* TO ‘monty’@’localhost’;
FLUSH PRIVILEGES;
quit

nginx – ArchWiki

MariaDB – ArchWiki

PHP – ArchWiki