准备
安装
- apche2以及相关mod,例如mod_php、mod_rewrite、mod_ssl
- mysql
- php7.0以及相关组件,例如php7.0-mysql、php7.0-curl等。
- 下载wordpress,解压到/var/www目录。
配置
去域名提供商处添加DNS解析,使域名指向VM的公网IP。
mysql中创建wordpress数据库。
/etc/apache2/apache2.conf
中添加1
2
3
4
5
6<Directory /var/www/wordpress>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>/etc/apache2/sites-available/000-default.conf
中修改:1
2
3DocumentRoot /var/www/wordpress
ServerName OpenLab
RewriteEngine on新增
/etc/apache2/sites-available/openlab-ssl.conf
,内容与000-default.conf
基本一致,不同点:1
2
3
4<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/apache2/www_openlabtesting_org.pem
SSLCertificateKeyFile /etc/apache2/www_openlabtesting_org.key其中证书可以去let’s encrypt免费申请。OpenLab使用的域名提供商Dnsimple自动集成了Let’s encrypt,直接去Dnsimple下载即可。
创建
/var/www/wordpress/wp-content/tmp
目录,修改/var/www/wordpress/wp-config.php
,新增1
2
3
4define('WP_TEMP_DIR',ABSPATH.'wp-content/tmp');
define("FS_METHOD","direct");
define("FS_CHMOD_DIR",0777);
define("FS_CHMOD_FILE",0777);访问网站域名,根据wordpres提示,安装网站。
登陆
https://{domain_name}/wp-admin
,后台设计、配置wordpress网站。