迁移前:Windows Server 2008 R2、MySQL Server 5.7、AppServer、PHP7
迁移后:Ubuntu 20.04、MySQL Server 8、Apache、PHP7.4
1、安装MySQL Server
2、备份并还原数据库
1 2 |
mysqldump -u 用户名 -p --database 数据库名 >filename.sql mysql -u 用户名 -p <filename.sql |
4、安装Apahce
1 |
apt install apache2 |
5、安装PHP7.4(实测PHP8有问题,虽然官网上标了支持)
1 2 3 4 |
apt install software-properties-common add-apt-repository ppa:ondrej/php apt-get update apt install imagemagick memcached redis-server gettext php7.4 php7.4-imagick php7.4-memcache php7.4-redis php7.4-bcmath php7.4-intl php7.4-mcrypt php7.4-cgi php7.4-fpm php7.4-mysql php7.4-curl php7.4-gd php7.4-imap php7.4-tidy php7.4-xmlrpc php7.4-xml php7.4-xsl php7.4-mbstring php7.4-zip php7.4-cli php7.4-soap php7.4-gmp php7.4-sqlite3 |
6、启用Apahce模块
1 2 3 4 5 |
a2enmod proxy_fcgi setenvif a2enconf php7.4-fpm a2enmod rewrite systemctl reload apache2 systemctl restart apache2 |
注意必须启用rewrite插件,否则固定链接会报错404。
7、备份并还原www目录
8、修改Apahce配置
官网配置:https://ubuntu.com/tutorials/install-and-configure-wordpress#4-configure-apache-for-wordpre
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
root@wordpress:/etc/apache2/sites-available# ls 000-default.conf default-ssl.conf root@wordpress:/etc/apache2/sites-available# cat 000-default.conf <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf <Directory /var/www/html> Options FollowSymLinks AllowOverride Limit Options FileInfo DirectoryIndex index.php Require all granted </Directory> <Directory /var/www/html/wp-content> Options FollowSymLinks Require all granted </Directory> </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet |
转载时请保留出处,违法转载追究到底:进城务工人员小梅 » WordPress 5.6.20由Windows迁移至Ubuntu 20.04