Переключенный от Apache до Nginx - 503 ошибки

Переключение от Apache до Nginx вызвало нас некоторые ошибки. Наши изображения форума не загружаются, и каталог с перенаправлениями и таким на самом деле не перенаправляет.

Этими двумя проблемами является/forum/uploads/avatars и/pack/. Вот конфигурации.

server {
    listen 80;

    root /var/www;
    server_name craftblock.me;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
        autoindex on;
        index  index.php index.html index.htm;
    }

    location ~ /forum/(inc|uploads/avatars) {
        allow all;
        try_files $uri;
        satisfy any;
    }

    location /forum {
        rewrite ^/forum/forum-([0-9]+)\.html$ /forum/forumdisplay.php?fid=$1;
        rewrite ^/forum/forum-([0-9]+)-page-([0-9]+)\.html$ /forum/forumdisplay.php?fid=$1&page=$2;
        rewrite ^/forum/thread-([0-9]+)\.html$ /forum/showthread.php?tid=$1;
        rewrite ^/forum/thread-([0-9]+)-page-([0-9]+)\.html$ /forum/showthread.php?tid=$1&page=$2;
        rewrite ^/forum/thread-([0-9]+)-lastpost\.html$ /forum/showthread.php?tid=$1&action=lastpost;
        rewrite ^/forum/thread-([0-9]+)-nextnewest\.html$ /forum/showthread.php?tid=$1&action=nextnewest;
        rewrite ^/forum/thread-([0-9]+)-nextoldest\.html$ /forum/showthread.php?tid=$1&action=nextoldest;
        rewrite ^/forum/thread-([0-9]+)-newpost\.html$ /forum/showthread.php?tid=$1&action=newpost;
        rewrite ^/forum/thread-([0-9]+)-post-([0-9]+)\.html$ /forum/showthread.php?tid=$1&pid=$2;

        rewrite ^/forum/post-([0-9]+)\.html$ /forum/showthread.php?pid=$1;

        rewrite ^/forum/announcement-([0-9]+)\.html$ /forum/announcements.php?aid=$1;

        rewrite ^/forum/user-([0-9]+)\.html$ /forum/member.php?action=profile&uid=$1;

        rewrite ^/forum/calendar-([0-9]+)\.html$ /forum/calendar.php?calendar=$1;
        rewrite ^/forum/calendar-([0-9]+)-year-([0-9]+)\.html$ /forum/calendar.php?action=yearview&calendar=$1&year=$2;
        rewrite ^/forum/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ /forum/calendar.php?calendar=$1&year=$2&month=$3;
        rewrite ^/forum/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ /forum/calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4;
        rewrite ^/forum/calendar-([0-9]+)-week-(n?[0-9]+)\.html$ /forum/calendar.php?action=weekview&calendar=$1&week=$2;

        rewrite ^/forum/event-([0-9]+)\.html$ /forum/calendar.php?action=event&eid=$1;

        # Google SEO workaround for search.php highlights:
        # Make this rule the first rewrite rule in your .htaccess!
        rewrite ^/MyBB/([^&]*)&(.*)$ http://yoursite/MyBB/$1?$2 permanent;

        # Google SEO Sitemap:
        rewrite ^/MyBB/((?i)sitemap-([^./]+)\.xml)$ /MyBB/misc.php?google_seo_sitemap=$2;

        # Google SEO URL Forums:
        rewrite ^/MyBB/((?i)Forum-([^./]+))$ /MyBB/forumdisplay.php?google_seo_forum=$2;

        # Google SEO URL Threads:
        rewrite ^/MyBB/((?i)Thread-([^./]+))$ /MyBB/showthread.php?google_seo_thread=$2;

        # Google SEO URL Announcements:
        rewrite ^/MyBB/((?i)Announcement-([^./]+))$ /MyBB/announcements.php?google_seo_announcement=$2;

        # Google SEO URL Users:
        rewrite ^/MyBB/((?i)User-([^./]+))$ /MyBB/member.php?action=profile&google_seo_user=$2;

        # Google SEO URL Calendars:
        rewrite ^/MyBB/((?i)Calendar-([^./]+))$ /MyBB/calendar.php?google_seo_calendar=$2;

        # Google SEO URL Events:
        rewrite ^/MyBB/((?i)Event-([^./]+))$ /MyBB/calendar.php?action=event&google_seo_event=$2;
    }

    location /nano/public {
        if (!-e $request_filename){
        rewrite ^(.*)$ /index.php/$1 break;
        }
        try_files $uri;
    }

    location ~ /index.php/ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location /phpmyadmin {
        root /usr/share/;
        index index.php index.html index.htm;
        location ~ ^/phpmyadmin/(.+\.php)$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
        }
        location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
            root /usr/share/;
        }
    }
    location /phpMyAdmin {
           rewrite ^/* /phpmyadmin last;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~/\.ht {
        deny all;
    }

}

Что я делаю неправильно? Не может понять это.

0
задан 16 April 2014 в 23:18
1 ответ

Проблема с местоположением /пакетом/публичным заключается в том, что место назначения перезаписи не заканчивается на .php. Это означает, что выполнение не передается по адресу ~ \.php$ никогда не используется для этих скриптов.

Если вам действительно нужно вызвать PHP-скрипты с помощью /index. php/URL стиль, вам нужно добавить новый блок местоположения, что-то вроде этого:

location ~ /index.php/ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}
0
ответ дан 5 December 2019 в 14:09

Теги

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