Перейти к содержимому

Сервер WAMP: Что я делаю не так?

0

Я новичок в веб-разработке ... и запуск WAMPServer - это барьер, который не может решить ни одна из проблем Google.

Когда я устанавливаю WAMPServer, он работает нормально. Когда я пытаюсь добавить локальные доменные имена, это идет не так. Кто-нибудь может сказать мне, почему?

Вещи, которые я попробовал.

В

C: / Windows / System32 / Drivers / и т.д. / хосты

я добавил

'127.0.0.1 my.testsite'

Затем в

C: /wamp/bin/apache/Apache2.2.22/conf/httpd.conf

Я удалил # из

'# Включить conf / extra / httpd-vhosts.conf'

Затем в C: /wamp/bin/apache/Apache2.2.22/conf/extra/httpd-vhosts.conf я добавил

<Directory C: / WAMPprojects>
Order Deny, Allow
Allow from all
</ Directory>

а также

<VirtualHost *: 80>
DocumentRoot «C: / WAMPprojects / Hermes»
ServerName my.testsite
</ VirtualHost>

Когда я ввожу my.testsite в адресную строку, я ожидаю увидеть содержимое страницы index.html, которая находится в папке Hermes.

После новой установки WAMP, где значок на панели задач становится зеленым, я внес эти изменения, и каждый раз, когда я перезагружаю сервер WAMP, он останавливается на оранжевом.

Поэтому я также попытался:

  • Выключение скайпа
  • Измените настройки Skype, чтобы он не прослушивал порт 80 (Инструменты> Параметры> Дополнительно> Соединение> Используйте порты 80 и 443 в качестве альтернативы для входящих подключений. Снимите флажок.)
  • Проверка, что больше ничего не слушает в порту 80
  • Меняем порт на 8080
  • Смена порта на другой номер
  • Добавление :: 1 к хостам

Я не могу определить, что происходит в журнале ошибок Apache.

Я на Windows XP (SP3) и Apache 2.2.22 Это случай несовместимости или это можно исправить?

Большое спасибо заранее, если кто-нибудь может дать мне подсказку - я застрял в течение нескольких месяцев.

2 631 просмотр
S_2434029 спросил 13 лет назад
S 1

3 ответа

1

Expanding on my comment:

The real key here is that when you restart Apache after modifying your conf files, your status icon isn't going green - this is most likely due to an issue with your configuration files (meaning you wouldn't have needed to futz around with Skype, ports, etc) - debug efforts should focus on the Apache conf files. I'm not sure where the errors with conf files get logged in WAMP, but I'd take the time to figure that out now if I were you . . .

I think the issue is that <directory> sections can't be top level in included conf files. As stated in the documentation, their context is server config or virtual host, meaning it needs to either be in the main conf file (i.e. httpd.conf) or in a <VirtualHost> definition. Try something like this:

< VirtualHost *:80> DocumentRoot “C:/WAMPprojects/Hermes” ServerName my.testsite <Directory C:/WAMPprojects> Order Deny,Allow Allow from all </Directory> < /VirtualHost> 

Не повезло, к сожалению: / Меня беспокоит, что это может быть так просто, но, возможно, я сдамся и попробую вместо этого XAMPP или AMPPS.

S_2434029 · 13 лет назад · 0

что в вашем apache error.log?

ernie · 13 лет назад · 0

Кроме того, переключение на один из других стековых дистрибутивов, вероятно, не поможет - у вас проблемы с Apache, который является общим потоком между всеми этими. , ,

ernie · 13 лет назад · 0
ernie ответил 13 лет назад
E 5 498
0

Вы пытались добавить ServerAlias, например:

<VirtualHost *:80> DocumentRoot "C:/WAMPprojects/Hermes" ServerName my.testsite ServerAlias my.testsite <Directory "C:/WAMPprojects/Hermes"> AllowOverride All Require all granted </Directory> </VirtualHost> 

?

Steve ответил 9 лет назад
S 1 109
-1

Here's some detail on what happens when your brower makes a request to a server that should fill in the details:

  • You type http://whatever.invalid in the address bar
  • Browser uses system resolver to issue a DNS request to convert whatever.invalid to an IP address
  • Browser makes HTTP GET request to the IP returned by that DNS request.
  • Within the header of that HTTP GET request, your browser places a "Host:" line, copying the domain name you used, i.e. "Host: whatever.invalid"
  • Apache gets the request, IF the IP was correct.
  • Apache checks the HTTP header for any "Host:" lines and uses the proper vhost, if such a configuration exists.

So, the piece of the puzzle you are missing is a DNS server willing to take your site name and return the IP on which your Apache server lives, which is currently localhost.

You could run your own local DNS server, or just dispense with vhosts and use http://localhost or http://127.0.0.1 in your browser.

Just reread your question more closely and saw that you used the hosts file. Try pinging my.testsite and see if 127.0.0.1 is returned by ping. You may need to remove any existing localhost references in the hosts file. (Incidentally, I just tried a ping -4 localhost on the Windows system I'm on and it did cause a ping to 127.0.0.1 ... so it may be something else ...)

Поскольку они изменили свой файл hosts, поиск DNS должен происходить локально. Конечно, если OP хочет проверить, что их файл хостов верен, он может просто перейти в командную строку и попытаться пропинговать my.testsite и посмотреть, разрешится ли он.

ernie · 13 лет назад · 0

Хорошо, я только что поймал это.

LawrenceC · 13 лет назад · 0
LawrenceC ответил 13 лет назад
L 58 376