Ubuntu, apache2 подстановочный знак DNS к субдомену

Главная проблема с монго для больших наборов данных - то, что монго использует файлы с отображенной памятью. Нет никакого способа ограничить сумму монго поршня, попытается использовать на машине. Таким образом, это в основном ожидает все ресурсы машины, специализированного поля. Это - только проблема, если Ваши данные являются большими и особенно когда Ваши индексы больше, чем поршень. Для ответа на вопрос о данных MongodDB действительно только попытается сохранить индексы в RAM.

0
задан 29 August 2012 в 08:30
2 ответа

You should be able to get the desired behavior with VirtualDocumentRoot.

Within your , add a ServerAlias to catch all the domains you're interested in:

    ServerAlias *.example.com

...then map them to the desired directories. Remove your DocumentRoot, and in its place, add:

    VirtualDocumentRoot /var/www/%1

You'll want to have a block allowing access, and keep in mind that this vhost should only be handling service for your dynamically configured vhosts - if you want example.com and www.example.com to be handled separately, then you'll want them to have their own .

Edit:

You'll want to use a different vhost to handle the "base" domains. Building off of the current config in the comment:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName catchall.example.com
    ServerAlias *.example.com
    # NOTE: this config will map test1.example.com to /var/www/test1
    VirtualDocumentRoot /var/www/%1
    # If you want that to map instead to /var/www/test1.example.com, then use %0:
    # VirtualDocumentRoot /var/www/%0
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Order Allow,Deny
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# This next vhost should be in a different file in sites-available to
# fit with debian-style vhosts - but make sure it's alphabetically
# after the file that contains the first vhost - we want it to load first
# so that it's default.  It can also just go in the same file.
<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias example.com
    DocumentRoot /var/www/www.example.com
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Order Allow,Deny
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
2
ответ дан 4 December 2019 в 21:40

Спасибо за помощь в поиске ответа. Здесь у меня есть решение моей проблемы. Думаю, это поможет другим новичкам, таким как я, найти решение вышеупомянутой проблемы.

шаг 1: настройте свой веб-сайт, как указано ниже

vi / etc / apache2 / sites-available / ваш сайт

ServerAlias ​​localhost * .yoursite #wildcard поймать все VirtualDocumentRoot / путь / к / вашему / рабочему пространству /% 1 / общедоступному UseCanonicalName Off <Каталог "путь / к / вашей / рабочей области"> Параметры FollowSymLinks AllowOverride All Заказать разрешить, запретить Разрешить от всех

2) sudo a2ensite / etc / apache2 / sites-available / yoursite

3) sudo service apache2 reload

4) Установите Dnsmasq: sudo apt-get install dnsmasq

5) открыть вверх /etc/NetworkManager/NetworkManager.conf и закомментируйте строку, которая читает dns = dnsmasq. После этого перезапустите NetworkManager: sudo restart network-manager.

6) vi /etc/dnsmasq.conf и строка listen-address = 127.0.0.1.

7) Создайте новый файл в /etc/dnsmasq.d и откройте файл и отредактируйте его следующим образом

address = / yourdomain / 127.0.0.1

8) Перезапустите Dnsmasq: sudo /etc/init.d/dnsmasq restart.

Это также можно сделать в nginx. и обратите внимание, что это решение сработало для меня. Думаю, это сработает и для всех остальных.

-1
ответ дан 4 December 2019 в 21:40

Теги

Похожие вопросы