Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 + PHP 8.1 – WordPress installation Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 + PHP 8.1 – 安装WordPress
条件。
终于安装好了 WordPress。这真是花了很长时间!
环境
Ubuntu 22.04
Nginx 1.22.1
MariaDB 10.6.11
PHP 8.1
Ubuntu 22.04
Nginx 1.22.1
MariaDB 10.6.11
PHP 8.1
设置
WordPress 的下载
切换到tmp目录并下载WordPress。
$ cd /tmp
$ wget https://ja.wordpress.org/latest-ja.tar.gz
$ tar -xvzf latest-ja.tar.gz
WordPress的安装
将从tmp目录下载的WordPress文件移动到/var/www/wordpress。
$ sudo mv wordpress /var/www/html/wordpress
将权限授予 www-data 用户以访问 WordPress 目录。
$ sudo chown -R www-data:www-data /var/www/html/wordpress
$ sudo chmod -R 755 /var/www/html/wordpress/
将文件夹中准备的wp-config-sample.php文件更名为wp-config.php。
$ sudo mv /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
在 wp-config.php 文件中添加使用 MariaDB 配置的用户名和密码信息。
$ sudo vi /var/www/html/wordpress/wp-config.php
// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** Database username */
define( 'DB_USER', 'username_here' );
/** Database password */
define( 'DB_PASSWORD', 'password_here' );
/** Database hostname */
define( 'DB_HOST', 'localhost' );
/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
请给出中文的同义句。
如果在安装PHP时进行了设置就好了,但是可能没有进行设置的人最好确认一下。
$ sudo cat /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
# # With php-cgi (or other tcp sockets):
}
}
$ sudo systemctl restart nginx
确认WordPress
