WordPress登录后台重定向次数过多的解决办法/ WordPress mixed content & redirected too many times

https://cloud.tencent.com/developer/article/1657681

如果你新安装的一个wordpress站点配置https后,再登录wordpress后台,却无法访问后台了[同时也可能会产生页面显示异常,F12会提示内容混杂,mixed content: the page at ” was loaded over https, but requested an insecure script ”. this request has been blocked; the content must be served over https.]。页面提示:将您重定向的次数过多,怎么办呢?

SEOSIR在这里为您分享wordpress网站开启https后台提示将您重定向的次数过多的解决方法如下:

你只需要在网站根目录的php文件wp-config.php开头加入以下代码,即可完美解决此问题了:

$_SERVER['HTTPS'] = 'on';
define('FORCE_SSL_LOGIN', true);
define('FORCE_SSL_ADMIN', true);

English Ver.

Under https environments, wordpress may be abnormal while loading resources, chrome inspection [F12] may indicate mixed content: the page at ” was loaded over https, but requested an insecure script ”. this request has been blocked; the content must be served over https.

And the login page shows redirected too many times

this is caused by the https configuration in the wordpress, you can add the following code in the wo-config.php file.

$_SERVER['HTTPS'] = 'on';
define('FORCE_SSL_LOGIN', true);
define('FORCE_SSL_ADMIN', true);

复制

Docker log设置和查询

docker logs 命令查询

 docker logs [选项] 容器名称

Name, shorthandDefaultDescription
--detailsShow extra details provided to logs
--follow , -fFollow log output
--sinceShow logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)
--tail , -nallNumber of lines to show from the end of the logs
--timestamps , -tShow timestamps
--untilShow logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)
logs 选项说明

https://docs.docker.com/engine/reference/commandline/logs/

docker logs设置

默认docker的log是没有上限的,如果日志文件过大会影响容器的运行速度,甚至卡死主机。可以在/etc/docker/daemon.json中加入以下选项来限制日志文件的大小,这样新的容器就会遵循此设置

{
“log-driver”: “json-file”,
“log-opts”: {“max-size”: “20m”, “max-file”: “3”}
}

VMware ESXi 7.0 Update 3 on Intel NUC

NUC(except 8th Gen) can install the original iso, and install the usb fling driver by command line(esxcli software vib install -d /absolute/path/to/vib )

original:https://www.virten.net/2021/11/vmware-esxi-7-0-update-3-on-intel-nuc/

VMware vSphere ESXi 7.0 Update 3 has been released in October and before you start to deploy it to production, you want to evaluate it in your testing environment or homelab. If you have Intel NUCs or similar hardware you should be very careful when updating to new ESXi releases as there might be issues. Please always keep in mind that this is not an officially supported platform and there might be compatibility issues.

In vSphere 7.0, there are ups and downs with consumer-grade network adapters. Since the deprecation of VMKlinux drivers, there is no option to use Realtek-based NICs, and previous versions had problems with the ne1000 driver. Luckily there is the great Community Networking Driver for ESXi Fling that adds support for a bunch of network cards and VMKUSB-NIC-FLING always covers your back.

I’ve updated my NUC portfolio to check which NUCs are safe to update and what considerations you have to take before installing the update. Additionally, I’m taking a look at the consequences of the recently deprecated USB/SD-Card usage for ESXi Installations and some general Issues in 7.0u3.

ESXi 7.0 Update 3 with Community Network Driver (8th Gen Bean Canyon / 11th Gen NUC)

The ne1000 driver packed in 7.0 Update 3 still does not work with the Intel I219-V (6) network adapter, which is used in the 8th Gen Bean Canyon NUCs. But this problem can be easily solved with the Fling Driver. For reference, these are the ne1000 drivers versions used in 7.0 releases:

ne1000 0.8.4-10vmw.700.1.0.15843807 <- ESXi 7.0 GA
ne1000 0.8.4-11vmw.701.0.0.16850804 <- ESXi 7.0 Update 1
ne1000 0.8.4-11vmw.702.0.0.17630552 <- ESXi 7.0 Update 2
ne1000 0.8.4-11vmw.703.0.0.18644231 <- ESXi 7.0 Update 3

For the following NUCs, the Fling driver is required:

  • NUC8i7BEH/NUC8i7BEK (Intel Core i7-8559U – 4 Core, up to 4.5 GHz)
  • NUC8i5BEH/NUC8i5BEK (Intel Core i5-8259U – 4 Core, up to 3.8 GHz)
  • NUC8i3BEH/NUC8i3BEK (Intel Core i3-8109U – 2 Core, up to 3.6 GHz)
  • 11th Gen NUC (NUC11PAQi7, NUC11PAHi7, NUC11PAKi7, NUC11PAQi5, NUC11PAHi5, NUC11PAKi5, NUC11PAHi3, NUC11PAKi3, NUC11TNHv70L, NUC11TNHv7, NUC11TNHv50L, NUC11TNHv5, NUC11TNKv7, NUC11TNKv5, NUC11TNHi70Q, NUC11TNHi70L, NUC11TNHi7, NUC11TNHi50W, NUC11TNHi50L, NUC11TNHi5, NUC11TNHi30P, NUC11TNHi30L, NUC11TNHi3, NUC11TNKi7, NUC11TNKi5, NUC11TNKi3)
  • Any NUC-Style alternative with 11th Gen Intel CPU and 2.5GBps Network Adapter (Eg. ASRock Industrial NUC 1100)

Download the Update Bundle and Fling:

New Installation
If you want to do a fresh install of ESXi 7.0 U3, you have to create a custom image, including the Community Driver.

Use the following PowerShell commands to add the community driver to the stock image.

Add-EsxSoftwareDepot .\VMware-ESXi-7.0U3-18644231-depot.zip
Add-EsxSoftwareDepot .\Net-Community-Driver_1.2.2.0-1vmw.700.1.0.15843807_18835109.zip
New-EsxImageProfile -CloneProfile "ESXi-7.0U3-18644231-standard" -name "ESXi-7.0U3-18644231-NUC" -Vendor "virten.net"
Add-EsxSoftwarePackage -ImageProfile "ESXi-7.0U3-18644231-NUC" -SoftwarePackage "net-community"
Export-ESXImageProfile -ImageProfile "ESXi-7.0U3-18644231-NUC" -ExportToISO -filepath ESXi-7.0U3-18644231-NUC.iso

Use the ESXi-7.0U3-18644231-NUC.iso image to install ESXi 7.0 U3 on your NUC. (Create a Bootable ESXi Installer USB Flash Drive

Update
If you’ve already installed ESXi, use the following commands to create an update bundle that contains the required package.

Add-EsxSoftwareDepot .\VMware-ESXi-7.0U3-18644231-depot.zip
Add-EsxSoftwareDepot .\Net-Community-Driver_1.2.2.0-1vmw.700.1.0.15843807_18835109.zip
New-EsxImageProfile -CloneProfile "ESXi-7.0U3-18644231-standard" -name "ESXi-7.0U3-18644231-NUC" -Vendor "virten.net"
Add-EsxSoftwarePackage -ImageProfile "ESXi-7.0U3-18644231-NUC" -SoftwarePackage "net-community"
Export-ESXImageProfile -ImageProfile "ESXi-7.0U3-18644231-NUC" -ExportToBundle -filepath ESXi-7.0U3-18644231-NUC.zip

Use ESXi-7.0U3-18644231-NUC.zip to update ESXi 7.0 U3:

# esxcli software vib install -d /path/ESXi-7.0U3-18644231-NUC.zip

ESXi 7.0 Update 3 on any other Intel NUC

Any other NUC, down to the 5th Gen can be installed and upgraded with the original image.

VMware vSphere Hypervisor (ESXi) 7.0U3 [Release Notes] [Download]

ESXi 7.0 Update 3 with VMKUSB-NIC-FLING

If you want to use USB-based network adapters, you can use the VMKUSB-NIC-FLING.

Download the Update Bundle and Fling:

Create ISO and Update Bundle

Add-EsxSoftwareDepot .\VMware-ESXi-7.0U3-18644231-depot.zip
Add-EsxSoftwareDepot .\ESXi703-VMKUSB-NIC-FLING-51233328-component-18902399.zip
New-EsxImageProfile -CloneProfile "ESXi-7.0U3-18644231-standard" -name "ESXi-7.0U3-USBNIC" -Vendor "virten.net"
Add-EsxSoftwarePackage -ImageProfile "ESXi-7.0U3-USBNIC" -SoftwarePackage "vmkusb-nic-fling"
Export-ESXImageProfile -ImageProfile "ESXi-7.0U3-USBNIC" -ExportToIso -filepath ESXi-7.0U3-USBNIC.iso
Export-ESXImageProfile -ImageProfile "ESXi-7.0U3-USBNIC" -ExportToBundle -filepath ESXi-7.0U3-USBNIC.zip

You should now have two files, an .ISO for new installation and a .ZIP for updates.

Alternative Update Option for Installations with VMKUSB-NIC-FLING

If you try to update existing installations directly using original bundles, the update fails with the following error message.

[root@esx4:~] esxcli software vib install -d /vmfs/volumes/images/VMware/Fling/ESXi703-VMKUSB-NIC-FLING-51233328-component-18902399.zip
 [DependencyError]
 VIB VMW_bootbank_vmkusb-nic-fling_1.8-3vmw.703.0.15.51233328 requires vmkapi_2_9_0_0, but the requirement cannot be satisfied within the ImageProfile.
 VIB VMW_bootbank_vmkusb-nic-fling_1.8-3vmw.703.0.15.51233328 requires vmkapi_incompat_2_9_0_0, but the requirement cannot be satisfied within the ImageProfile.
 Please refer to the log file for more details.
[root@esx4:~] esxcli software vib install -d /vmfs/volumes/images/VMware/vSphere\ 7.0/VMware-ESXi-7.0U3a-18825058-depot.zip
 [DependencyError]
 VIB VMW_bootbank_vmkusb-nic-fling_1.8-3vmw.702.0.20.47140841 requires vmkapi_incompat_2_8_0_0, but the requirement cannot be satisfied within the ImageProfile.
 Please refer to the log file for more details.

The solution is quite simple. You first have to remove the Fling from the Rebooting Image and then install the Update and new driver.

  1. Place the Host into Maintenance Mode
  2. Remove the Fling. Depending on how you’ve installed it, one of the following commands will remove it:# esxcli software vib remove -n vmkusb-nic-fling # esxcli software component remove -n VMware-vmkusb-nic-fling
  3. Install the ESXi Update (Remember to always use the full path when installing bundles with esxcli. A relative path does not work!)# esxcli software vib install -d /[PATH]/VMware-ESXi-7.0U3a-18825058-depot.zip
  4. Install VMKUSB-NIC-FLING# esxcli software component apply -d /[PATH]/ESXi703-VMKUSB-NIC-FLING-51233328-component-18902399.zip
  5. Reboot ESXi

ESXi 7.0 Update 3 and the deprecation of SD card/USB as a boot device

For production environments, you have to consider moving away from SD cards and USB drives as boot devices for ESXi. They still work in ESXi 7.0 but VMware has announced that they will no longer be supported in future versions.

As of today, and for Home Labs, especially with U3 – It is perfectly fine to go on with USB drives.

Official KB: Removal of SD card/USB as a standalone boot device option (85685)

ESXi 7.0 Update 3 Critical Known Issues and Workarounds

Since the release of ESXi 7.0 Update 3, a couple of critical issues have been identified.

  • Possible PSOD when virtual machines on a VMFS6 thin disk execute UNMAP/TRIM functions. – Solved in 7.0 U3a
  • Network Driver Name changed from i40enu to i40en – Workaround available: KB85982
  • VAMI Backup Error due to default behavior for FIPS compliance changed – Workaround available: KB86069
  • vSphere HA Issues on Upgraded Hosts – Workaround available: KB86191

See: KB86287

ESXI6.7重启后丢失usb网卡 vswitch lose physical adapters after reboot

Chinese version

ESXI6.7重启后丢失usb网卡,导致虚拟机无法上网。

解决方法:

参考https://kzpu.com/archives/4400.html

使当前的usb网卡映射持久化,就是说,重启后usb网卡照样可以使用。可能对esxi7.0可以解决,但是6.7映射后仍然无法识别。

esxcli system module parameters set -p "$(esxcli network nic list |grep vusb |awk '{print $1 "_mac=" $8}' | awk 1 ORS=' ')" -m vmkusb_nic_fling

编辑 /etc/rc.local.d/local.sh 

思路就是,先强制添加vusb0到上行链路(名字根据实际设备修改),此时虽然后台显示正常,但是仍然无法上网,然后删除虚拟交换机的上行链路,再次添加,此时应该上网恢复正常。推测和设备初始化的顺序相关。

参考https://communities.vmware.com/t5/ESXi-Discussions/vswitch-lose-physical-adapters-after-reboot/td-p/465644

vusb0_status=$(esxcli network nic get -n vusb0 | grep 'Link Status' | awk '{print $NF}')

count=0

while [[ $count -lt 20 && "${vusb0_status}" != "Up" ]] ]

do

    sleep 10

    count=$(( $count + 1 ))

    vusb0_status=$(esxcli network nic get -n vusb0 | grep 'Link Status' | awk '{print $NF}')

done

if [ "${vusb0_status}" = "Up" ]; then

esxcli network vswitch standard uplink add --uplink-name=vusb0 --vswitch-name=vSwitch1
sleep 10
esxcli network vswitch standard uplink remove --uplink-name=vusb0 --vswitch-name=vSwitch1
sleep 10
esxcli network vswitch standard uplink add --uplink-name=vusb0 --vswitch-name=vSwitch1

fi

English version

vswitch lose physical adapters after reboot, cannot add uplink through the Esxi console

Solution:

reference https://kzpu.com/archives/4400.html

make the usb network module parameter permenent, this may help in esxi 7.0, however I failed in esxi 6.7.

esxcli system module parameters set -p "$(esxcli network nic list |grep vusb |awk '{print $1 "_mac=" $8}' | awk 1 ORS=' ')" -m vmkusb_nic_fling

I tried another solution ,it solved my problem. loging in the ssh shell, edit this file /etc/rc.local.d/local.sh . using command line to add vusb0(you can change this name according to your situation) to the vswitch, although the vswitch showed the uplink, it failed to function normally, so I deleted the uplink and added it back to the vswitch ,it worked as magic. any problem feel free to contact me by admin@datascientist.top

reference https://communities.vmware.com/t5/ESXi-Discussions/vswitch-lose-physical-adapters-after-reboot/td-p/465644

vusb0_status=$(esxcli network nic get -n vusb0 | grep 'Link Status' | awk '{print $NF}')

count=0

while [[ $count -lt 20 && "${vusb0_status}" != "Up" ]] ]

do

    sleep 10

    count=$(( $count + 1 ))

    vusb0_status=$(esxcli network nic get -n vusb0 | grep 'Link Status' | awk '{print $NF}')

done

if [ "${vusb0_status}" = "Up" ]; then

esxcli network vswitch standard uplink add --uplink-name=vusb0 --vswitch-name=vSwitch1
sleep 10
esxcli network vswitch standard uplink remove --uplink-name=vusb0 --vswitch-name=vSwitch1
sleep 10
esxcli network vswitch standard uplink add --uplink-name=vusb0 --vswitch-name=vSwitch1

fi

n2n编译 Alpine & openwrt

采用docker来构造编译环境,比较方便

openwrt编译

sudo docker run --rm -v ~/tmp/:/home/ -it openwrtorg/rootfs:21.02.0 #22好像没有gcc所以没有选latest
cd n2n
opkg update && opkg install autoconf automake  gcc bash make
./autogen.sh
./configure CFLAGS='-static'  #可以静态编译 也可以取消 n2n作者不建议静态编译
make
make install

Alpine编译(alpine编译的可以给openwrt使用 同架构下)

sudo docker run --rm -v ~/tmp/:/home/ -it alpine
apk add --update  autoconf automake  gcc bash make linux-headers  libc-dev
./autogen.sh
./configure CFLAGS='-static'   #可以静态编译 也可以取消 n2n作者不建议静态编译
make
make install

MacOS 11 降级到10.X

老的macbook用最新的11,经常出现系统卡死的现象,于是决定降级,但是降级不能直接降级,app store不支持直接降级了,所以只能用移动u盘来制作启动盘的方式进行降级。

1、下载镜像

一开始选择的10.8的镜像,10.8的镜像和其他的镜像制作USB启动盘的方式不太一样

https://osxdaily.com/where-download-macos-installers/

2、制作10.8启动盘

参考的这篇文章来制作u盘启动盘,其实就是找到InstallESD.dmg这个文件;但是在抹掉磁盘的过程中,发现权限不足,需要另外方法来制作u盘启动盘,参考这篇文章来制作u盘启动盘,参考如下命令,就是将InstallESD.dmg写入到u盘

sudo /usr/sbin/asr restore --source BaseSystem.dmg --target /Volumes/MyVolume --erase

3、安装系统

重启后,按住option,选择刚才制作好的移动硬盘,先用磁盘管理工具清除系统盘才可以继续安装,否则安装过程中无法识别硬盘。

10.8太古老了,chrome都不支持了,app store也没办法登录,只好更新到10.12,

4、制作10.12启动盘

尝试用这篇文章来制作10.12的启动盘,但是发现命令不太对,没有深究。但是从10.8可以直接用下载好的10.12的dmg来升级,就不制作10.12的启动盘了。

Nightscout部署及使用(私有云部署)

Nightscout(是一款开源云应用程序,糖尿病患者和糖尿病儿童的父母使用它来实时可视化、存储和分享传感器的数据。设置完毕后,Nightscout就可以自动存储血糖等数据,浏览器即可在任何地方查看CGM图表和治疗数据。

这个系统有几个部分:

1、Nightscout网站,负责存储和展示

2、数据上传,一般通过传感器收集数据,然后通过手机上传;目前我们采用的是瞬感探头+喵喵传感器+xdrip手机软件采集

3、可以选择使用其他设备访问/查看这些数据;可以通过xdrip来订阅网站的数据,xdrip可以实现灵活的报警设置,也支持震动模式,比较方便

网站部署

nightscout提供了docker部署,注意,nightscout本身提供一键部署到Heroku 云服务,heroku本身免费,需要注册GitHub,同时heroku服务稳定性目前未知。

本文采用了docker的国内云部署方式,如果有任何疑问,欢迎来信admin@datascientist.top

  1. 安装docker,不同操作系统安装不一样,可以参考不同操作系统的选项,对于debian系,直接sudo apt-get install docker-ce docker-compose
  2. 安装portainer,docker的图形管理界面,运行docker run -d -p 9000:9000 -name dev-portainer portainer/portainer
  3. 安装nightscout, 编辑docker-compose.yml 文件
  4. 运行 sudo docker-compose -f docker-compose.yml up
  5. 这样文件里面设置的port就是nightscout的端口了,不过nightscout默认要求用https访问,所以可以用cdn内容分发网络进行强制https跳转,也可以用linuxserver/letsencrypt的docker进行ssl证书获取和https跳转,具体参考对应云的cdn服务解决方案
  6. 也可以参考官方的配置,暂时没有验证过https://github.com/nightscout/cgm-remote-monitor/blob/master/docker-compose.yml

version: '3.1'
services:
  nsmongo:
    image: 'mongo:latest'
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: $your_mongo_username
      MONGO_INITDB_ROOT_PASSWORD: $your_mongo_pass
    volumes:
      - $/your/path/to/db:/data/db
  nswebserver:
    image: 'nightscout/cgm-remote-monitor:latest'
    depends_on:
        - nsmongo
    restart: always
    environment:
      - 'MONGO_CONNECTION=mongodb://$your_mongo_username:$your_mongo_pass@nsmongo/$your_mongo_username'
      - PORT=1366
      - TZ="Asia/Shanghai"
      - DISPLAY_UNITS=mmol
      - DEVICESTATUS_ADVANCED="true"
      - ENABLE=sage%20rawbg%20careportal%20openaps
      - API_SECRET=$your_api_pass
      - INSECURE_USE_HTTP=true
    ports:
      - '8888:1366'
  mongo-express:
    image: mongo-express
    restart: always
    ports:
      - 8081:8081
    depends_on:
      - nsmongo
    environment:
      ME_CONFIG_MONGODB_$your_mongo_usernameUSERNAME: $your_mongo_username
      ME_CONFIG_MONGODB_$your_mongo_usernamePASSWORD: $your_mongo_pass
    ME_CONFIG_MONGODB_URL:'mongodb://$your_mongo_username:$your_mongo_pass@nsmongo/$your_mongo_username'


网站管理

访问对应的nightscout网站,右上角的三个横线就是网站设置,进入后点击第二个admin tools输入API_SECRET即可进行设置,可以进行数据删除之类的操作

参考文章

免费配置,包括上面的docker部署,都可能会有一定的变化,如果有任何问题,欢迎联系admin@datascientist.top

NightScout免费创建云服务共享

申请nightscout血糖网站 2021

Nightscout部署及使用

部署

nightscout提供了docker部署,注意,nightscout本身提供一键部署到Heroku 云服务,heroku本身免费,需要注册GitHub,同时heroku服务稳定性目前未知。

本文采用了docker的国内云部署方式,如果有任何疑问,欢迎来信admin@datascientist.top

  1. 安装docker,不同操作系统安装不一样,可以参考不同操作系统的选项,对于debian系,直接sudo apt-get install docker-ce docker-compose
  2. 安装portainer,docker的图形管理界面,运行docker run -d -p 9000:9000 -name dev-portainer portainer/portainer
  3. 安装nightscout, 编辑docker-compose.yml 文件
  4. 运行 sudo docker-compose -f docker-compose.yml up
  5. 这样文件里面设置的port就是nightscout的端口了,不过nightscout默认要求用https访问,所以可以用cdn内容分发网络进行强制https跳转,也可以用linuxserver/letsencrypt的docker进行ssl证书获取和https跳转,具体参考对应云的cdn服务解决方案

version: '3.1'
services:
  nsmongo:
    image: 'mongo:latest'
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: $your_mongo_username
      MONGO_INITDB_ROOT_PASSWORD: $your_mongo_pass
    volumes:
      - $/your/path/to/db:/data/db
  nswebserver:
    image: 'nightscout/cgm-remote-monitor:latest'
    depends_on:
        - nsmongo
    restart: always
    environment:
      - 'MONGO_CONNECTION=mongodb://$your_mongo_username:$your_mongo_pass@nsmongo/$your_mongo_username'
      - PORT=1366
      - TZ="Asia/Shanghai"
      - DISPLAY_UNITS=mmol
      - DEVICESTATUS_ADVANCED="true"
      - ENABLE=sage%20rawbg%20careportal%20openaps
      - API_SECRET=$your_api_pass
      - INSECURE_USE_HTTP=true
    ports:
      - '8888:1366'
  mongo-express:
    image: mongo-express
    restart: always
    ports:
      - 8081:8081
    depends_on:
      - nsmongo
    environment:
      ME_CONFIG_MONGODB_$your_mongo_usernameUSERNAME: $your_mongo_username
      ME_CONFIG_MONGODB_$your_mongo_usernamePASSWORD: $your_mongo_pass
      ME_CONFIG_MONGODB_URL:'mongodb://$your_mongo_username:$your_mongo_pass@nsmongo/$your_mongo_username'

管理

访问对应的nightscout网站,右上角的三个横线就是网站设置,进入后点击第二个admin tools输入API_SECRET即可进行设置,可以进行数据删除之类的操作

mac安装n2n

#安装ruby
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

#安装tun cmake ssl等支持
brew tap homebrew/cask
brew install tuntap
brew install openssl
brew install cmake

#如果是linux 需要安装 openssl sudo apt-get install libssl-dev

# clone或者unzip n2n压缩包
git clone https://github.com/ntop/n2n

#开始编译
mkdir build
cd build 
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl ../
make

# optionally install
make install

参考文章 https://blog.csdn.net/nokiaxjw/article/details/88872172

https://github.com/meyerd/n2n/wiki