Update from Sync Service

This commit is contained in:
FNS Service
2026-04-21 17:40:59 +08:00
parent 4b1817c74b
commit f282f6363f
32 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
WordPress的安装与配置
下载wordpress
[plain] view plain copy
wget https://wordpress.org/latest.zip
安装unzip:
[plain] view plain copy
apt-get install unzip
解压和后续操作
[plain] view plain copy
unzip -q latest.zip -d /var/www/html/
cd /var/www/html/wordpress
cp -a * ..
rm -r wordpress/
chown www-data:www-data -R /var/www/html/
创建上传目录:
[plain] view plain copy
mkdir -p /var/www/html/wp-content/uploads
chown www-data:www-data -R /var/www/html/wp-content/uploads
mysql相关操作
创建mysql账户
[plain] view plain copy
mysql -u root -p
[sql] view plain copy
```sql
CREATE DATABASE wordpress character set utf8 collate utf8_bin;
```
GRANT ALL PRIVILEGES on wordpress.* to 'wpuser'@'localhost' identified by 'your_password';
FLUSH PRIVILEGES;
exit
编辑配置文件
[plain] view plain copy
cd /var/www/html
mv wp-config-sample.php wp-config.php
vim wp-config.php
[plain] view plain copy
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress'); /** MySQL database username */
define('DB_USER', 'wpuser'); /** MySQL database password */
define('DB_PASSWORD', 'your_password'); /** MySQL hostname */
define('DB_HOST', 'localhost');
设置固定链接:
如果是设置了虚拟主机的话这部分可能和下面的操作不一样我也不太清楚可以去google搜一下
[plain] view plain copy
vim /etc/apache2/sites-available/000-default.conf
[plain] view plain copy
[...]
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ServerName server1.example.com
<Directory /var/www/html/>
AllowOverride All
</Directory>
[...]
就是在里面添加上ServerName到</Directory>这一段
允许URL的重写以及Apache2的重启
[plain] view plain copy
a2enmod rewrite
service apache2 restart
创建.htaccess文件
[plain] view plain copy
touch /var/www/html/.htaccess
chown :www-data /var/www/html/.htaccess
chmod 664 /var/www/html/.htaccess
添加wordpress安全保护其实我也不太懂具体作用
访问 https://api.wordpress.org/secret-key/1.1/salt/
然后打开wp-config.php
[plain] view plain copy
vim /var/www/html/wp-config.php
[plain] view plain copy
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');
将其对应填入。