@glebn
Золото, а не человек!

Почему /etc/hosts игнорируется wsl (ubuntu на windows)?

Добрый день!
Установил LAMP сервер на Subsystem for Linux (WSL) (Ubuntu bash встроенная в windows 10)
Все встало ровненько, mysql, ftpd и апач запускаются.
Тестовый дефолтный адрес с приветом от апача localhost тоже запускается.
НО
Добавление хостов, не дает никакого эффекта.
Например test.com
ping на test.com проходит (127.0.0.1).
права на hosts файл поставил 777, редактировал в nano

Вот листинги:
/etc/hosts
127.0.0.1	localhost
127.0.0.1	DESKTOP-DSMA6HA.localdomain	DESKTOP-DSMA6HA
127.0.0.1	example.com
127.0.0.1	test.com

# 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


/etc/apache2/sites-available/test.com.conf
<VirtualHost *:80>
    ServerAdmin admin@test.com
    ServerName test.com
    ServerAlias www.test.com
    DocumentRoot /var/www/test.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


/etc/apache2/apache2.conf:
Mutex file:${APACHE_LOCK_DIR} default

PidFile ${APACHE_PID_FILE}

TimeOut 300

KeepAlive on

MaxKeepAliveRequests 100

KeepAliveTimeout 5


User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

Include ports.conf

<Directory />
	Options FollowSymLinks
	AllowOverride None
	Require all denied
</Directory>

<Directory /usr/share>
	AllowOverride None
	Require all granted
</Directory>

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride None
	Require all granted
</Directory>


AccessFileName .htaccess

<FilesMatch "^\.ht">
	Require all denied
</FilesMatch>

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf

AcceptFilter http none
  • Вопрос задан
  • 1746 просмотров
Решения вопроса 1
@glebn Автор вопроса
Золото, а не человек!
Решение - дополнительно прописывать хосты в hosts самого windows:
C:\Windows\System32\drivers\etc\hosts
127.0.0.1 test.com
127.0.0.1 example.com


Не подумал об этом сразу т.к. дефолтный адрес localhost после установки апача открывается и без этих манипуляцй
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы