通过127.0.0.1可以正常访问到虚拟机中的网站,但通过hosts文件中配置的域名访问就报503错误,原因是被v2rayN干扰

我使用virtualbox,主机是Windows 11,虚拟机是Ubuntu 24,配置了端口映射8086到8086。

网站在Ubuntu 24虚拟机里可以通过test.com:8086正常访问到,也可以通过127.0.0.1:8086正常访问到,这说明我的Nginx配置没有问题。我在Windows 11的C:\Windows\System32\drivers\etc\hosts里面配置了:
127.0.0.1 test.com
我在Windows 11里使用127.0.0.1:8086可以正常访问到Ubuntu 24虚拟机中的这个网站,但是使用test.com:8086访问不到,报503错误。可能的原因是什么,该如何解决这个错误?

原因是被v2rayN干扰,清除系统代理后,使用test.com:8086就能正常访问虚拟机中的这个网站。更好解决方法是,打开v2rayN的设置->参数设置->系统代理设置窗口,填入要被v2rayN忽略的网站地址。这样这些网站就不会被v2rayN干扰了,同时我们也能在Windows里能正常使用v2rayN。

在Rocky 10虚拟机中安装VirtualBox增强功能时遇到“找不到内核头文件”报错的解决方法

1. 启用 EPEL 仓库并安装必要软件包

# 启用 EPEL 仓库
sudo dnf install epel-release

# 安装内核开发头文件和相关工具
sudo dnf install kernel-devel kernel-headers gcc make perl dkms
sudo dnf install kernel-modules-extra

2. 检查内核版本匹配是否匹配开发包的版本

# 查看当前运行的内核版本
uname -r

# 查看已安装的内核开发包版本
rpm -qa | grep kernel-devel
rpm -qa | grep kernel-headers

# 如果版本不匹配,安装对应版本的开发包
sudo dnf install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

3. 安装 VirtualBox 增强功能

安装 VirtualBox 增强功能之前记得先更新一下系统:

sudo dnf update

方法一:通过VirtualBox菜单安装

  1. 启动虚拟机
  2. 在 VirtualBox 菜单中选择 设备 → 插入客户机增强功能 CD 镜像
  3. 挂载 CD 后运行安装

方法二:手动输入命令安装

# 挂载增强功能 CD
sudo mkdir -p /mnt/cdrom
sudo mount /dev/cdrom /mnt/cdrom

# 进入 CD 目录并安装
cd /mnt/cdrom
sudo ./VBoxLinuxAdditions.run

# 卸载 CD
sudo umount /mnt/cdrom

安装VirtualBox7警告missing dependencies python core_win32api的解决方法

解决这个警告的步骤是:

1 先退出VirtualBox安装程序

2 下载安装最新版本的Python,并把Python可执行程序所在目录加入环境变量PATH

3 打开终端窗口,运行以下命令安装Python的pywin32包:

py -m pip install pywin32

4 重新运行VirtualBox安装程序,应该就没有这个警告了

参考

https://stackoverflow.com/questions/78414273/virtual-box-python-core-win-32-api-issue
https://www.sysnettechsolutions.com/en/fix-python-win32api-virtualbox/

安装中文语言包composer require “overtrue/laravel-lang:~6.0″后,在浏览器刷新页面报错Call to undefined method Illuminate\Translation\FileLoader::loadPath()

我的Laravel版本是10,报错原因是overtrue/laravel-lang:~6.0与Laravel 10不兼容,composer require “overtrue/laravel-lang”输出一条警告说:

Package overtrue/laravel-lang is abandoned, you should avoid using it.

在Laravel 10我们应该使用laravel-lang/lang语言包。因此这个报错的解决方法是,先移除overtrue/laravel-lang:~6.0包:

composer remove overtrue/laravel-lang

再安装laravel-lang/lang语言包:

composer require laravel-lang/lang

安装好了后,执行以下命令添加中文语言包到Laravel 10:

php artisan lang:add zh_CN

我们可以看到在resources/lang目录里增加了zh_CN.json文件和zh_CN文件夹。

然后修改config/app.php,找到’locale’ => ‘en’,改为’locale’ => ‘zh_CN’。

刷新浏览器看看。

更多laravel-lang/lang语言包的用法,例如如何添加多个语言包到Laravel、如何在“语言.json”文件里增加自定义的条目等,请查看laravel-lang/lang语言包的官方文档:Getting Started | Laravel Lang (laravel-lang.com)

参考

https://www.cnblogs.com/inkqx/p/13563856.html

VirtualBox Linux虚拟机与Windows宿主机的共享文件夹里面无法创建符号链接的解决方法

我的软件环境:

VirtualBox虚拟机:Ubuntu 22

宿主机:Windows 10

在Ubuntu 22虚拟机的共享文件夹中创建符号链接时,可能的报错有以下几种:

第一种,在运行npm install esbuild时报错:

Error: EPERM: operation not permitted, symlink '../esbuild/bin/esbuild' -> '/var/www/reverb.test/node_modules/.bin/esbuild'

第二种,执行PHP代码创建符号链接时报错:

symlink(): Operation not permitted

第三种,运行ln命令时报错:

ln: failed to create symbolic link 'xxx.so.0': Read-only file system

第四种,运行cp命令时报错:

cannot create symbolic link `xxxx':Read-only file system

第五种,运行cp命令时报错:

cannot create symbolic link `xxxx': Protocol error

……

原因是VirtualBox从安全角度出发,限制了软链接(符号链接)的创建。如果想正常使用符号链接,需要对虚拟机设置 VBoxInternal2/SharedFoldersEnableSymlinksCreate/<share_folder_name> 这个选项。这里顺带一提,对于 vagrant,这个选项只要你运行 vagrant up之后这个选项便会自动设置好。可以使用 VboxManage.exe设置这个选项 ,这个工具在 Windows 下是和 VirtualBox 图形界面程序在一个相同目录的。以下是详细步骤:

1 关闭 VirtualBox。

2 以管理员身份打开命令行窗口,cd到VirtualBox安装目录(例如cd C:\Programs\Oracle\VirtualBox),执行如下命令:

VBoxManage setextradata YOURVMNAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/YOURSHAREFOLDERNAME 1

其中:

  • YOURVMNAME填写ubuntu 虚拟机系统的名称
  • YOURSHAREFOLDERNAME填写共享文件夹的名称,注意这个共享文件夹名称是你在 VirtualBox 中设置共享时对应的“共享文件夹名称”一栏的内容,不是共享文件夹的路径或者文件夹的名称。

例如:

VBoxManage setextradata Ubuntu22 VBoxInternal2/SharedFoldersEnableSymlinksCreate/share 1

3 以管理员身份运行VirtualBox

参考

https://blog.csdn.net/tekenuo/article/details/82386552

https://tty.moe/blog/virtualbox-symlink-windows

Why Multiple Elasticsearch Nodes Fail to Form a Cluster: master_not_discovered_exception or NotMasterException and How to Fix It

If you’ve encountered a situation where multiple Elasticsearch nodes fail to automatically form a cluster and the logs show the error: “master_not_discovered_exception”, you are not alone.

The Problem

The root cause is often related to system administrators cloning virtual machines to create multiple Elasticsearch servers. When this happens, every Elasticsearch node ends up with the same node ID, and as a result, the cluster cannot successfully elect a master node.

Verifying the Issue

You can verify this issue by listing all the node IDs with the following command:

GET /_cat/nodes?v&h=id,ip,name&full_id=true

However, since the Elasticsearch cluster hasn’t formed, you need to query each node individually, like this:

curl 192.168.110.111:9200/_cat/nodes?v&h=id,ip,name&full_id=true
curl 192.168.110.112:9200/_cat/nodes?v&h=id,ip,name&full_id=true

The Solution

Elasticsearch requires each node to have a unique node ID. To fix this issue, you need to delete the index data on each node. If Elasticsearch was installed using the RPM package, the index data is usually stored in /var/lib/elasticsearch by default. After deleting the data, restart Elasticsearch, and it will generate a new, unique node ID for each node.

Reference

For further details, check the full article here: https://www.656463.com/wenda/jdbhjrjqNotMasterExceptionqgddxc_359.

Windows 10 or Windows 11 Only Shows One Hard Drive After Reinstallation? Here’s the Fix

If you have two hard drives in your system but only see one in “This PC” after reinstalling Windows 10 or 11, follow these steps to resolve the issue:

  1. Right-click on This PC and select Manage.
  2. Go to Device Manager under System Tools and check Disk drives. If both drives are listed, it means the second drive is recognized and there is no issue with the hardware.
  3. Now, open Storage > Disk Management.
  4. Right-click on the second hard drive and select Change Drive Letter and Paths. Assign a drive letter to the second drive.

After doing this, the second drive should appear in This PC in File Explorer.

Windows 10或Windows 11有两个硬盘,但重装系统后在“此电脑”里只显示一个的问题及解决方法

右键点“此电脑”->系统工具->设备管理->磁盘驱动器,看看里面是否有两个硬盘驱动,如果是,说明第二块磁盘驱动没有问题,再打开存储->磁盘管理,右键点击第二块磁盘->更改驱动器号和路径,设置一下驱动器号,就可以在资源管理器的“此电脑”路径下出现了。

How to Restore Files Deleted by Windows Defender on Windows 10 and Windows 11?

For Windows 10:
1.Open Windows Security Center
2.Go to Virus & threat protection
3.Navigate to Threat history
4.Check the Detected threats
5.Select Restore

For Windows 11:
1.Open Windows Security Center
2.Go to Virus & threat protection
3.Navigate to Protection history
4.Check the Quarantined threats
5.Select Restore

Important Note
Restoring quarantined files requires administrative privileges on your Windows system.

Windows10和Windows11如何还原被Windows Defender删除的文件?

对于Windows10:

打开Windows安全中心->病毒和威胁防护->威胁历史记录->检查出的威胁->还原

对于Windows11:

打开Windows安全中心->病毒和威胁防护->保护历史记录->已隔离威胁->还原

注意事项

在还原被隔离的文件时,需要你有Windows系统的管理员权限。