nginx - 无法访问在具有虚拟主机的 Windows 10 wsl 上运行的 Nginx
问题描述
所以我决定在带有 WSL 的 Windows 10 上安装 ubuntu 20。默认情况下,它带有我删除并设置为默认 nginx 的 Apache。当我尝试localhost
从我的 Windows 访问时,我得到了 nginx 默认页面(它工作正常)。但是在我的虚拟机上,我添加了一个无法从 Windows 机器打开的虚拟主机。当我尝试访问server_name
我在虚拟机的主机文件和 Windows 的主机文件中添加的内容时,我不能。
这是我的虚拟主机配置文件。
server {
listen 80;
listen [::]:80;
server_name admin.finestgreens.local www.admin.finestgreens.local;
root /home/melomancheto/www/shop-admin/public;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
我检查了 fpm 路径,如果.sock
文件存在并且它在那里。我有以下配置sites-available
这是我的符号链接sites-enabled
我检查过,我nginx
的运行正常,我的php-fpm
.
这是我在 Linux 和 Windows 机器上的 hosts 文件
我错过了一些东西,但我不知道是什么..
This site can’t be reachedCheck if there is a typo in admin.finestgreens.local.
If spelling is correct, try running Windows Network Diagnostics.
DNS_PROBE_FINISHED_NXDOMAIN
这是我尝试访问我的server_name
.
问题已解决,我的网址有错字 xD
解决方案
推荐阅读
- ios - 如何在拆分视图控制器中将数据从详细信息发送到主控
- xamarin.forms - 将引脚添加到 Mapsui(Xamarin 表单)时出现异常
- javascript - 区分 Bootstrap Modal 中的按钮
- javascript - 状态数组上的 React array.splice 不能正确更新 dom?
- python - 为什么当我操作它的副本时,这个队列会清空?
- scala - ChiselTest:将有符号整数转换为无符号整数以获得期望值
- c# - 数据上下文注册为瞬态,但内存使用量不断增长。我的 DI 配置有问题吗?
- bash - 如果有条件使用 Awk 搜索确切的 Bash 变量字符串
- c++ - 轮询时无法接收来自 IBM MQ 服务器的响应
- php - Wordpress 自动缩放更新