在nginx配置文件中添加以下代码:
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # PHP版本号根据实际情况进行更改
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
然后,在WordPress安装目录中找到wp-config.php文件,添加以下内容:
define('FS_METHOD', 'direct');
define('FS_CHMOD_DIR', 0777);
define('FS_CHMOD_FILE', 0777);
保存并重新加载nginx配置文件,即可成功设置“用户”。