固定IP
nano /etc/network/interfaces
修改为
# Wired adapter #1 allow-hotplug eth0 no-auto-down eth0 #iface eth0 inet dhcp iface eth0 inet static address 172.20.20.94 netmask 255.255.254.0 gateway 172.20.20.1 dns-nameservers 172.20.20.1 8.8.8.8
重启
systemctl restart networking
apt-get install nginx –y
或者
apt-get install apache2 –y apt-get install php php-fpm php-mysql php-gd php-curl php-mbstring php-xml -y systemctl enable php7.3-fpm
开启nginx php支持
nano /etc/nginx/sites-enabled/default
修改root根目录
root /usr/share/nginx/html;
添加
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}测试和重启
nginx -t nginx -s reload
编辑php测试页面
echo "<?php phpinfo(); ?>" > /var/www/html/index.php
安装数据库
apt-get install mariadb-server mysql-common –y mysql_secure_installation mysql –u root -p
use mysql;
select user,host,plugin from user;
update user set authentication_string=password("root123"),plugin='mysql_native_password' where user='root';
flush privileges;
select user,host,plugin from user;
