Гуру | Привет друзья! Нужен совет бывалого админа. Что я делаю не так? Есть сайт на WP, который крутиться на VPS (Nginx + php5-fpm). От апача давно отказался на всех своих проектах. Вот такой конфиг хоста nginx работал до установки форума:
Развернуть текст Код: #user 'user' virtual host 'mysite.ru' configuration file
server {
server_name mysite.ru www.mysite.ru;
charset off;
disable_symlinks if_not_owner from=$root_path;
index index.html index.php;
root $root_path;
set $root_path /var/www/user/data/www/mysite.ru;
access_log /var/www/httpd-logs/mysite.ru.access.log ;
error_log /var/www/httpd-logs/mysite.ru.error.log notice;
listen 111.111.111.111:80; #тут ip сервера
include /etc/nginx/vhosts-includes/*.conf;
gzip on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_comp_level 6;
location ~* \.(css|js|png|gif|jpg|jpeg)$ {
expires max;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all; # запрет для загруженных скриптов
error_page 403 /disabled/index.html;
}
location ~ /\. {
deny all; # запрет для скрытых файлов
error_page 403 /disabled/index.html;
}
location / {
try_files $uri $uri/ /index.php?$args;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @php;
}
}
location @php {
fastcgi_index index.php;
fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@mysite.ru";
fastcgi_pass unix:/var/www/php-fpm/user.sock;
fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
try_files $uri =404;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include fastcgi_params;
}
ssi on;
} [свернуть] Установил XenForo в папку mysite.ru/community. Ничего не меняя в конфиге, инсталлирую форум. В настройках устанавливаю ЧПУ и транслитерацию. Страница mysite.ru/community открывается нормально, однако при переходе в какой-либо форум (mysite.ru/community/forums/test/) получаю 404 страницу, которую отдает Wordpress. Добавляю в конфиг следующее:
Код: location /community/ {
try_files $uri $uri/ /community/index.php?$uri&$args;
index index.php index.html;
}
location /community/internal_data/ {
internal;
}
location /community/library/ {
internal;
} Теперь при переходе на mysite.ru/community браузер предлагает скачать файл без имени и расширения, с таким содержимым:
PHP код: <?php
$startTime = microtime(true);
$fileDir = dirname(__FILE__);
require($fileDir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);
$fc = new XenForo_FrontController(new XenForo_Dependencies_Public());
$fc->run();
Подозреваю, что конфликт происходит из-за тех правил, которые были в конфиге раньше, но не могу понять в чем проблема. ---------- Сообщение добавлено 23:36 ---------- Предыдущее 23:18 ---------- Вот так всегда происходит: я пол дня мучился, потом создал тему на форуме, а через 5 минут нашел решение. Вдруг кому пригодится: Для секции
Код: location /community/ {
try_files $uri $uri/ /community/index.php?$uri&$args;
index index.php index.html;
} необходимо добавить:
Код: location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @php;
} |