当前位置:首页 > Linux

玩客云armbian安装mariadb+nginx+php

canca3年前 (2023-09-24)Linux978

         本来想装Apache2的,无耐armbian死活没装到,以试着看的态度装nginx,没想到装上了,那算了,只好用nginx+php吧,现在记录一下遇过的坑,玩客云机器是armbian 11系统,更新源后,能装php7.4,nginx 1.18,apache2死活装不上,能装上的是apache2.4版本,mysql也是装不上,不支持arm系统,那只能安装mariadb了


1.安装mariadb

直接装吧

sudo apt update
sudo apt install mariadb-server

装好后看版本

mariadb --version

现在运行以下命令来启动 MariaDB 并使其在系统重启时自动启动:

sudo systemctl start mariadb
sudo systemctl enable mariadb

默认情况下,MariaDB 未加固。您可以使用mysql_secure_installation脚本保护 MariaDB

mysql_secure_installation

现在可以使用新密码连接到 MariaDB 服务器

mysql -u root -p

2.安装nginx

直接装吧

apt update
sudo apt install nginx

运气好的话,可以直接装好,运气不行的话用下面方式:

sudo apt install aptitude
aptitude install nginx

3.安装php

直接装吧

sudo apt-get install php php-mysql php-mbstring php-gd php-xml

也是那句,运气好的话,可以直接装好,运行不行的话用下面方式:

aptitude install php php-mysql php-mbstring php-gd php-xml  php7.4-fpm

zblog一定要装 php-xml,MD,搞了我半天!还有php7.4-fpm,开始装不上的,后来不知道为什么又能装了

装好的PHP,需要修改两处地方

nano /etc/php/7.4/cli/php.ini
# ctrl+\ 定位 date.,找到date.timezone,修改如下:
date.timezone = PRC
# 修改日志显示,MD,就这里搞了我半天,一直白屏不知道什么错误,明明是开了日志就是不显示
display_errors = On

修改好后,看看nginx如何配置吧!

nginx 默认装到这里/etc/nginx/,先说说这个目录,下面有两个文件夹,需要关注的:

1、sites-available

2、sites-enabled

根据问文心一言得知,配置的网站配置先放sites-available上,哪些网站需要解释的,就软链到sites-enabled目录,如果不想解释某个网站就删除软链,感觉一点不好用。

#哪个网站要解释的话软链过去
ln -s /etc/nginx/sites-available/eolinker_os /etc/nginx/sites-enabled/

现在测试一下,直接修改sites-available下的Default配置,配置如下:

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
	listen 80 default_server;
	listen [::]:80 default_server;

	# SSL configuration
	#
	# listen 443 ssl default_server;
	# listen [::]:443 ssl default_server;
	#
	# Note: You should disable gzip for SSL traffic.
	# See: https://bugs.debian.org/773332
	#
	# Read up on ssl_ciphers to ensure a secure configuration.
	# See: https://bugs.debian.org/765782
	#
	# Self signed certs generated by the ssl-cert package
	# Don't use them in a production server!
	#
	# include snippets/snakeoil.conf;

	#这里不改了,直接用这里吧
	root /var/www/html;

	# Add index.php to the list if you are using PHP
	index index.php index.html index.htm index.nginx-debian.html;

	server_name _;

	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		try_files $uri $uri/ =404;
	}

	# pass PHP scripts to FastCGI server
	#  把下面这段配置打开
	location ~ \.php$ {
		include snippets/fastcgi-php.conf;
		# With php-fpm (or other unix sockets):
		fastcgi_pass unix:/run/php/php7.4-fpm.sock;
		# With php-cgi (or other tcp sockets):
		# fastcgi_pass 127.0.0.1:9000;
	}

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	# 这段打也打开吧,
	location ~ /\.ht {
		deny all;
	}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#	listen 80;
#	listen [::]:80;
#
#	server_name example.com;
#
#	root /var/www/example.com;
#	index index.html;
#
#	location / {
#		try_files $uri $uri/ =404;
#	}
#}

生成一个phpinfo.php文件到/var/www/html目录下,内容如下:

<?php phpinfo(); ?>

一切就绪了,然后重启nginx和php

systemctl restart nginx
systemctl restart php7.4-fpm
#测试一下是否OK
curl http://localhost/phpinfo.php
#正常会打印一堆HTML,那表示OK了


记录一下常用命令:

#卸载以php开头的软件包,不会删除配置文件
sudo apt remove php*
#清除以php开头的软件包,包含配置文件
sudo apt purge php*
#删除不再需要的软件包及其依赖项
sudo apt autoremove

这次从刷机到重装花了两天半,接近3天,总算装好了!

扫描二维码推送至手机访问。

版权声明:本文由Ant.Master's Blog发布,如需转载请注明出处。

本文链接:https://iant.work/post/865.html

分享给朋友:

“玩客云armbian安装mariadb+nginx+php” 的相关文章

在Linux下安装和使用MySQL

一、引言 想使用Linux已经很长时间了,由于没有硬性任务一直也没有系统学习,近日由于工作需要必须使用Linux下的 MySQL。本以为有Windows下使用SQL Server的经验,觉得在Linux下安装MySql应该是易如反掌的事,可在真正安装和使用…

wget下载文件

一、下载目录#wget -r -np -nd http://example.com/packages/这条命令可以下载 http://example.com 网站上 packages 目录中的所有文件。其中,-np 的作用是不遍历父目录,-nd 表示不在本机重新创建目录结构。二、下载指定扩展名文件#…

解决linux下DNS无法解析,mysql大小写敏感问题

下午项目启动的时候报[net.sf.ehcache.Cache]-[ERROR] Unable to set localhost. This prevents creation of a GUID. Cause was: IDC-V-70024: IDC-V-70024 java.net.…

Linux VPS新硬盘分区与挂载教程

通过fdisk -l我们可以看到/dev/xvdb(此名称因系统而异)容量有23.6G,而且没有分区,接下来我们对它进行分区和挂载 (红色字为需要输入的部分,黑色字为系统显示部分) 1.fdisk -l [root@MyVPS ~]# fdisk -l Disk /dev/xvda: 8589 MB…

linux shell下除了某个文件外的其他文件全部删除的命令

linux shell下除了某个文件外的其他文件全部删除的命令

Linux反选删除文件最简单的方法是# shopt -s extglob      (打开extglob模式)# rm -fr !(file1) 如果是多个要排除的,可以这样:# rm -rf !(file1|file2) Lin…

CentOS 7最小化安装后找不到‘ifconfig’命令——修复小提示

就像我们所知道的,“ifconfig”命令用于配置GNU/Linux系统的网络接口。它显示网络接口卡的详细信息,包括IP地址,MAC地址,以及网络接口卡状态之类。但是,该命令已经过时了,而且在最小化版本的RHEL 7以及它的克隆版本CentOS&n...…

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。