Manjaro 安装 Nginx、Mysql、PHP 环境
安装软件前 update
sudo pacman -Syu
安装 Nginx
sudo pacman -S nginx
查看 Nginx 状态和版本信息
sudo systemctl status nginx
nginx -v
设置开机启动和重启 Nginx 服务
sudo systemctl enable nginx
sudo systemctl restart nginx
安装 Mysql
sudo pacman -S mysql
**初始化MariaDB数据目录,没有这步 mysql 就不能用
**
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
查看mysql状态
sudo systemctl status mysqld
开机启动 mysql 务
sudo systemctl enable mysqld
sudo systemctl start mysqld
安装 PHP
sudo pacman -S php php-fpm
开机启动 PHP 服务
sudo systemctl enable php-fpm
sudo systemctl start php-fpm
修改nginx配置文件
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
修改nginx配置文件
进入站点目录,创建测试文件,默认为 /usr/share/nginx/html/
cd /usr/share/nginx/html/
sudo vim index.php
写入如下内容
<?php phpinfo(); ?>
nginx FastCGI错误Primary script unknown解决办法
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »