..png)
PHPStorm을 사용하여 PHP 관련 작업을 수행하기 위해 Windows에서 WSL을 설정하는 중입니다. 구성을 시작하고 Apache와 PHP를 설치했습니다. 확인하기 위해 에서 브라우저를 열었는데 localhost
작동하지만 127.0.0.1
작동하지 않습니다.
포트 전달을 통해 xdebug 디버깅을 구성하려면 작동해야 합니다. 나는 docker로 작업하는 다른 (Linux) 컴퓨터에서 쉽게 수행하는 데 익숙했던 localhost를 사용하여 그렇게 하지 못했습니다.
내 우분투 내부에서:
~$ cat /etc/hosts
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateHosts = false
127.0.0.1 localhost
127.0.1.1 JB-PC.localdomain JB-PC
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Windows에서:
C:\WINDOWS\system32>ipconfig
Configuration IP de Windows
Carte Ethernet Ethernet :
Suffixe DNS propre à la connexion. . . : Home
Adresse IPv6 de liaison locale. . . . .: fe80::f04e:ae2b:40b9:3d82%6
Adresse IPv4. . . . . . . . . . . . . .: 10.0.0.8
Masque de sous-réseau. . . . . . . . . : 255.255.255.0
Passerelle par défaut. . . . . . . . . : 10.0.0.138
Carte Ethernet vEthernet (WSL) :
Suffixe DNS propre à la connexion. . . :
Adresse IPv6 de liaison locale. . . . .: fe80::68c3:25c9:588a:a957%17
Adresse IPv4. . . . . . . . . . . . . .: 172.20.32.1
Masque de sous-réseau. . . . . . . . . : 255.255.240.0
Passerelle par défaut. . . . . . . . . :
localhost
::1에 핑을 보냅니다.
C:\WINDOWS\system32>ping localhost
Envoi d’une requête 'ping' sur JB-PC [::1] avec 32 octets de données :
Réponse de ::1 : temps<1ms
Réponse de ::1 : temps<1ms
Réponse de ::1 : temps<1ms
Réponse de ::1 : temps<1ms
Statistiques Ping pour ::1:
Paquets : envoyés = 4, reçus = 4, perdus = 0 (perte 0%),
Durée approximative des boucles en millisecondes :
Minimum = 0ms, Maximum = 0ms, Moyenne = 0ms
핑 도 127.0.0.1
마찬가지입니다.
C:\WINDOWS\system32>ping 127.0.0.1
Envoi d’une requête 'Ping' 127.0.0.1 avec 32 octets de données :
Réponse de 127.0.0.1 : octets=32 temps<1ms TTL=128
Réponse de 127.0.0.1 : octets=32 temps<1ms TTL=128
Réponse de 127.0.0.1 : octets=32 temps<1ms TTL=128
Réponse de 127.0.0.1 : octets=32 temps<1ms TTL=128
Statistiques Ping pour 127.0.0.1:
Paquets : envoyés = 4, reçus = 4, perdus = 0 (perte 0%),
Durée approximative des boucles en millisecondes :
Minimum = 0ms, Maximum = 0ms, Moyenne = 0ms
또한 나는 답변을 시도했습니다여기, 그러나 그들은 도움이 되지 않았습니다.
[편집] @NotTheDr01ds 제안에 따라 Python을 사용해 보았습니다. 포트 8080에서 localhost 또는 127.0.0.1에 액세스하는 것은 모두 동일하게 작동하지만 http://0.0.0.0:8080/
이상하게 액세스하는 것은 CLI에서 제공한다고 말하는 것이지만 이상하게 작동하지 않습니다.
C:\WINDOWS\system32>python3 -m http.server 8080 --bind 0.0.0.0
Serving HTTP on 0.0.0.0 port 8080 (http://0.0.0.0:8080/) ...
127.0.0.1 - - [17/Apr/2021 21:20:38] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [17/Apr/2021 21:20:39] code 404, message File not found
127.0.0.1 - - [17/Apr/2021 21:20:39] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [17/Apr/2021 21:21:15] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [17/Apr/2021 21:21:15] code 404, message File not found
127.0.0.1 - - [17/Apr/2021 21:21:15] "GET /favicon.ico HTTP/1.1" 404 -
내 아파치 가상호스트:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /mnt/c/Users/JB/Documents/projects/bdzserver/public
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
<Directory /mnt/c/Users/JB/Documents/projects/bdzserver>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>