参考文档:
- wordPress教程: https://www.seo628.com/allinonewordpress
- 安装配置https: https://yongwp.com/2143.html
apache2.4 + php8.2 的安装和配置
apache2.4 + php8.2 的安装
该步骤略。详情请参考 安装教程
修改apache安装目录下的conf/httpd.conf
添加如下内容:
1Listen 83
修改apache安装目录下的conf/extra/httpd-vhosts.conf
添加如下内容:
1<VirtualHost *:83>
2 ServerAdmin conggege325@qq.com
3 directoryIndex index.html index.htm index.php
4 ServerName cggcms.cpolar.cn
5 DocumentRoot "D:/dev/workspaces/cms-wordpress"
6 <Directory "D:/dev/workspaces/cms-wordpress">
7 Options -Indexes
8 AllowOverride All
9 Require all granted
10 </Directory>
11</VirtualHost>
wordpress 下载和安装
下载地址: https://wordpress.org/download/
下载后,解压至网站根目录(即上面配置的apache虚拟主机目录)即可
修改nginx的配置
修改nginx安装目录下的conf/nginx.conf,添加如下内容:
1 server {
2 listen 80;
3 server_name cggcms.cpolar.cn;
4
5 location / {
6 proxy_set_header Host $host;
7 proxy_set_header X-Real-IP $remote_addr;
8 proxy_set_header REMOTE-HOST $remote_addr;
9 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
10 proxy_pass http://cggcms.cpolar.cn:83;
11 }
12 }
修改windows的hosts文件
文件路径:C:\Windows\System32\drivers\etc\hosts,添加内容:
1127.0.0.1 cggcms.cpolar.cn
然后在浏览器中访问: http://cggcms.cpolar.cn ,按照提示一步步配置即可。
设置 https 访问
修改网站改域名为https
两种方法:
- 打开设置页面 http://cggcms.cpolar.cn/wp-admin/options-general.php 中, 修改:
WordPress 地址(URL)和站点地址(URL)为指定的https地址。例如:
https://cggcms.cpolar.cn - 直接修改数据库中的
wp_options表(如果没有在安装时修改表名前缀,就是这个名字;否则就是类似于xx_options的表名),找到siteurl和home,修改为指定的https地址。
解决wordPress的重定向的次数过多的问题
在网站根目录下的wp-config.php中加入以下代码(一般加在define('WP_DEBUG', false);后面):
1$_SERVER['HTTPS'] ='on';
2define('FORCE_SSL_LOGIN', true);
3define('FORCE_SSL_ADMIN', true);
测试是否能正常访问:
注意:如果是外网的https,要去掉hosts的的相关配置
wordpress地址: https://cggcms.cpolar.cn
评论