سؤال

بعض التفاصيل

  • xampp 1.7.1.
  • نظام التشغيل تم اختباره على نظام التشغيل Vista و XP

مرحبا بالجميع. لدي بعض المشاكل مع تكوين المضيفين الظاهريين. حاليا لدي موقعين.

هنا هو ملف vhost.conf الخاص بي:

<VirtualHost *:80>
    ServerAdmin me@site.nl
    DocumentRoot c:/xampp/htdocs/site1/trunk/
    ServerName site1.local
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin me@site.nl
    DocumentRoot c:/xampp/htdocs/site2/trunk/
    ServerName site2.local
</VirtualHost>

وبالطبع في ملف المضيف لدي

127.0.0.1 site1.local
127.0.0.1 site2.local

لقد قمت بإعادة تشغيل Apache وكذلك متصفحي عدة مرات.

هنا مشكلتي:

http: //site1.local. يعمل. ولكن عندما أذهب إلى http: //site2.local., أنا أراضي في الموقع 1.الوكلي.

أيه أفكار؟

هل كانت مفيدة؟

المحلول

يحاول

<VirtualHost "site1.local">
    ServerAdmin spam@a1230912##ad#.nl
    DocumentRoot c:/xampp/htdocs/site1/trunk/
    ServerName site1.local
</VirtualHost>

<VirtualHost "site2.local">
    ServerAdmin spam@a1230912##ad#.nl
    DocumentRoot c:/xampp/htdocs/site2/trunk/
    ServerName site2.local
</VirtualHost>

تحصل دائما على Site1 لأن Apache افتراضيا إلى الأول.

تعديل

إلغاء التعليق

#NameVirtualHost *

ل

NameVirtualHost *

في httpd.conf.

يقول لي (/etc/httpd/conf/httpd.conf)

126 # Listen: Allows you to bind Apache to specific IP addresses and/or
127 # ports, in addition to the default. See also the <VirtualHost>
128 # directive.
129 #
130 # Change this to Listen on specific IP addresses as shown below to 
131 # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
132 #
133 Listen 127.0.0.1:80
134 NameVirtualHost 127.0.0.1

وملف vhost الخاص بي

<VirtualHost "www.whatever.com">
        DocumentRoot /var/www/html/whatever/pub
        ErrorLog logs/error_log
        ServerName www.whatever.com
...
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top