安装软件
apt upgrade
apt remove apache2
apt install nginx
apt install mysql-server
apt install php8.3
apt install php8.3-fpm
apt install php8.3-mysql
apt install php8.3-curl
apt install php8.3-common
apt install php8.3-cli
配置Nginx
vi /etc/nginx/sites-enabled/default
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.html index.htm index.nginx-debian.html;
server_name _;
location / {
index index.html;
# 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/php-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;
#}
}
测试网页
cd /var/www/html/
vi test.php
<?php
phpinfo();
?>
访问ip/test.php
wordpress
root@u1:~# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 36
Server version: 10.3.39-MariaDB-0ubuntu0.20.04.2 Ubuntu 20.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
MariaDB [(none)]> create database wordpress default character set utf8 collate utf8_unicode_ci;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> create user 'wp'@'localhost' identified by 'wp';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> grant all privileges on *.* to 'wp'@'localhost';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> exit
下载worpress
curl -O https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
cp ./wordpress/wp-config-sample.php ./wordpress/wp-config.php
mkdir ./wordpress/wp-content/upgrade
cp -a ./wordpress/* /var/ww/html/wordpress
vim /usr/share/nginx/html/wp-config.php
dbname wordpress
dbuser wp
passwd wp