Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/classes/modules/topic/Topic.class.php on line 481

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/classes/modules/topic/Topic.class.php on line 481

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/classes/modules/topic/Topic.class.php on line 368

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/classes/modules/topic/Topic.class.php on line 368

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/classes/modules/topic/Topic.class.php on line 584

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/classes/modules/topic/Topic.class.php on line 584
Системное администрирование / pyhapyha.ru - социальная сеть сайта pyha.ru
Рейтинг
+1.14
голосов:
1
avatar

Системное администрирование  

Системное администрирование →  Nginx, apache2: автоматические субдомены

Поведаю вам как сделать автоматические субдомены для связки nginx-apache.
Имеем структуру папок такую

path/to/website/example.com
		example.com/www //домен по умолчанию, обращение через example.com, www.example.com
		example.com/subomain //subdomain.example.com
		example.com/other-sub //other-sub.example.com

Конфиг NGinx:
server {
    listen   80;
    server_name example.com *.example.com;
    set $subdomain "www";
    if ($host ~* ^([a-z0-9-\.]+)\.example.com$) {
        set $subdomain $1;
    }
    if ($host ~* ^www.example.com$) {
        set $subdomain "www";
    }
    access_log /var/logs/nginxaccess_example.com.log main;
    error_log /var/logs/nginxerror_example.com.log;
    # Статическиое наполнение отдает сам nginx
    # back-end этим заниматься не должен 
    location ~* \.(jpg|jpeg|gif|png|ico|css|bmp|swf|js)$ {
        root path/to/website/example.com/$subdomain;
    }
    # Перенаправление на back-end
    location / {
        root path/to/website/example.com/$subdomain;
        proxy_pass  http://127.0.0.1:8181;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-for $remote_addr;
		proxy_set_header Host $host;
		proxy_connect_timeout 120;
		proxy_send_timeout 120;
		proxy_read_timeout 180;
    }
}

Apache
Вариант #1 — Используем vhost_alias
Конфиг:
<VirtualHost *:8181>
	ServerName example.com
	CustomLog /var/logs/apache2_example.com.log combined
	DocumentRoot /path/to/website/example.com/www
</VirtualHost>
<VirtualHost *:8181>
	ServerName www.example.com
	ServerAlias *.example.com
	CustomLog /var/logs/apache2_subdomainexample.com.log combined
	VirtualDocumentRoot /path/to/website/example.com/%1
</VirtualHost>	

Вариант #2 — Используем mod_rewrite:
Конфиг:
<VirtualHost *:8181>
	ServerName example.com
	CustomLog /var/logs/apache2_example.com.log combined
	DocumentRoot /path/to/website/example.com/www
	ServerAlias *.example.com
	RewriteEngine On
	RewriteCond %{HTTP_HOST} !^www.example.com$
	RewriteCond %{HTTP_HOST} ^((.*)\.)example.com$
	RewriteRule ^/(.*) /%2/$1
</VirtualHost>


На этом все. Выражаю благодарность adword'у.

  • Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/templates/compiled/%%F3^F3B^F3B39BC9%%topic_list.tpl.php on line 147

    Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/templates/compiled/%%F3^F3B^F3B39BC9%%topic_list.tpl.php on line 147
    0

  • Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 326

    Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 326

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 329

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 329

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 334

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 334
    28 января 2010, 16:32
  • mario
  • 8+8

Системное администрирование →  Заметка о том как сменить пароль root для MySQL.

Все операции выполняем из под root'a.
1. Останавливаем mysql, если он запущен.
service mysql stop

2. Запускаем mysql следующим образом
/usr/bin/mysqld_safe --skip-grant-tables --user=root &

3. Запускаем клиента mysql
mysql -u root

4. Выполняем sql запрос
UPDATE mysql.user SET Password=PASSWORD(’ВОТ_ТУТ_НОВЫЙ_ПАРОЛЬ’) WHERE User=’root’;

5. Применяем изменения
FLUSH PRIVILEGES;

6. Выходим из mysql клиента выполнив в нем команду
exit

7. Перегружаем mysql сервер.
service mysqld restart

На этом все, постарайтесь не забывать пароли…

  • Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/templates/compiled/%%F3^F3B^F3B39BC9%%topic_list.tpl.php on line 147

    Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/templates/compiled/%%F3^F3B^F3B39BC9%%topic_list.tpl.php on line 147
    0

  • Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 326

    Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 326

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 329

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 329

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 334

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 334
    18 января 2010, 20:28
  • mario
  • 2+2

Системное администрирование →  Настройка Debian-based LAMP в chroot-окружении

Настройка Debian-based LAMP в chroot-окружении


Большинство дистрибутивов linux и unix поставляются с большим разным количеством технологий которые повышают безопасность системы как в целом, так и в каких либо отдельных участках. Например в Убунте это AppArmor, в Федоре это SELinux и тд… Так же повышение безопасности системы повышается путем отключения лишних сервисов, закрытием портов и прочее… Но тем не менее, злоумышленники все-же могут найти способы обойти способы защиты. Строя chroot-окружение, мы так же создаем еще одну «ступеньку» защиты нашей операционной системы. Chroot — это изолированной окружение которое не имеет доступа к основной системе.

( Читать дальше )

  • Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/templates/compiled/%%F3^F3B^F3B39BC9%%topic_list.tpl.php on line 147

    Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/templates/compiled/%%F3^F3B^F3B39BC9%%topic_list.tpl.php on line 147
    +3

  • Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 326

    Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 326

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 329

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 329

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 334

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Moscow' for 'MSK/4,0/no DST' instead in /home/pyha/pyhapyha.ru/include/function.php on line 334
    9 января 2010, 09:46
  • mario
  • 4+4