一、购买域名
二、下载wordpress源码
cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xvf latest.tar.gz
sudo chown apache.apache wordpress/ -hR
三、配置httpd域名目录映射
配置http
sudo vi /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName *
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost *:80>
ServerAdmin ***@***.com
DocumentRoot /var/www/html/wordpress
ServerName frdxw.com
ServerAlias www.frdxw.com
</VirtualHost>
配置https
sudo vi /etc/httpd/conf.d/ssl.conf
NameVirtualHost *:443
SSLStrictSNIVHostCheck off
DocumentRoot “/var/www/html”
ServerName *:443
<VirtualHost *:443>
DocumentRoot “/var/www/html/wordpress”
ServerName frdxw.com
ServerAlias www.frdxw.com
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
#SSLCertificateChainFile “/etc/pki/tls/certs/server-chain.crt”
<FilesMatch “\.(cgi|shtml|phtml|php)$”>
SSLOptions +StdEnvVars
</FilesMatch>
<Directory “/var/www/html/wordpress”>
AllowOverride All
SSLOptions +StdEnvVars
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/www.frdxw.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.frdxw.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/www.frdxw.com/chain.pem
</VirtualHost>
四、https认证
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
sudo ./letsencrypt-auto
安装提示选择你要认证的域名,只有三个月的有效期,到时候需要更新
五、使用cloudflare隐藏真实ip
把阿里云的dns解析地址改成cloudflare的。
cloudflare中Crypto的SSL要改成Full的,要不然后面https会出现ERR_TOO_MANY_REDIRECTS错误,一直以为是cookie有问题,搞了好久。
另外说下cloudflare不能保护侵权内容的,有被投诉域名就不给你隐藏了,收费版不知道待遇会不会好点。
Crypto
Manage cryptography settings for your website
SSL
Encrypt communication to and from your website using SSL.
It may take up to 24 hours after the site becomes active on Cloudflare for new certificates to issue.
Note: SSL certificate issuance may take up to 24 hours.
Universal SSL Status Active Certificate