LinuxForum.Fans
Тема

Как создать сабдомен?

Автор: nat000 4 сообщений 1859 просмотров
#79751

нужна помощь коллективного разума smile

есть сайт , допустим site.com (www.site.com и site.com оба работают одинаково)

нужно создать сабдомен test.site.com

что было сделано:

1) в /etc/hosts добавлена запись:

было

text
127.0.0.1    localhost

# The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts

стало

text

127.0.0.1    localhost
127.0.0.1    test.localhost

# The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts

2) в /etc/apache2/sites-available добавлен новый хост subdomain :

text

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    
    ServerName test.site.com
    DocumentRoot /home/public_html/magento2
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /home/public_html/magento2>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride All
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride All Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory>

</VirtualHost>

работающий default:

text
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    
    
 DocumentRoot /home/public_html/magento
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /home/public_html/magento>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride All
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride All Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory>

</VirtualHost>

3) httpd.conf добавлено /home/public_html/magento2:

text
<Directory /home/public_html/magento>
AllowOverride All
</Directory>

<Directory /home/public_html/magento2> AllowOverride All </Directory>

4) apache stop, a2ensite subdomain, apache start ==> OK, появилась запись в /etc/apache2/sites-enabled/


при обращении к test.site.com никакой реакции, в логах в том числе :rolleyes:

#79754

Зону править надо, а не localhost

#79760

а где ее править?
поиск по имени домена везде, в том числе /etc/bind ничего не дает (в имени файлов и внутри файлов)

в var/lib/bind -пусто

#79797

named.conf такие зоны содержит:

// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

zone "localhost" {
type master;
file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};

Войдите или зарегистрируйтесь, чтобы ответить.