Используя Wordpress как подкаталог drupal установки?

Я запускаю Ubuntu 10.04 с NginX 0.7.65.

Мне установили Drupal в корневом каталоге, и он работает отлично с соответственно настроенным vhost файлом, но теперь я хотел бы установить Wordpress в подкаталоге на том же домене. Когда я перехожу к example.com/wordpress, это приводит к 404 ошибкам и обрабатывается Drupal. Вот мой vhost файл:

    server {
        server_name www.example.com example.com;
        access_log /srv/www/example.com/logs/access.log;
        error_log /srv/www/example.com/logs/error.log;
        root /srv/www/example.com/public_html;

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

        # This matters if you use drush
        location = /backup {
                deny all;
        }

        # Very rarely should these ever be accessed outside of your lan
        location ~* \.(txt|log)$ {
                allow 192.168.0.0/16;
                deny all;
        }

        location ~ \..*/.*\.php$ {
                return 403;
        }

        location / {
                # This is cool because no php is touched for static content
                try_files $uri @rewrite;
        }

        location @rewrite {
                # Some modules enforce no slash (/) at the end of the URL
                # Else this rewrite block wouldn't be needed (GlobalRedirect)
                rewrite ^/(.*)$ /index.php?q=$1;
        }

        location ~ \.php$ {
                include conf-inc.d/fastcgi.conf;
                track_uploads uploads 60s;
        }

        # The Nginx module wants ?X-Progress-ID query parameter so
        # that it report the progress of the upload through a GET
        # request. But the drupal form element makes use of clean
        # URLs in the POST.
        location ~ (.*)/x-progress-id:(\w*) {
                rewrite ^(.*)/x-progress-id:(\w*)  $1?X-Progress-ID=$2;
        }

        # Now the above rewrite must be matched by a location that
        # activates it and references the above defined upload
        # tracking zone.
        location ^~ /progress {
                report_uploads uploads;
        }

        # Fighting with ImageCache? This little gem is amazing.
        location ~ ^/sites/.*/files/imagecache/ {
                try_files $uri @rewrite;
        }

        # Catch image styles for D7 too.
        location ~ ^/sites/.*/files/styles/ {
                try_files $uri @rewrite;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }

        # Deny access to Apache .htaccess files.
        location ~ /\.ht {
                deny all;
        }

}
1
задан 19 January 2012 в 20:28
1 ответ

Получите вдохновение из ответа в аналогичной ветке на SO

проблема в этой директиве местоположения для php-fallback

location / {
        # This is cool because no php is touched for static content
        try_files $uri @rewrite;
}

location @rewrite {
        # Some modules enforce no slash (/) at the end of the URL
        # Else this rewrite block wouldn't be needed (GlobalRedirect)
        rewrite ^/(.*)$ /index.php?q=$1;
}

С этой конфигурацией вы переписываете все запросы в drupal index.php, включая ваши файлы wordpress. Решением является определение одного блока местоположения для обработки резервной копии php для wordpress

location  /wordpress {
    index index.php index.html index.htm;
    try_files $uri $uri/ /wordpress/index.php;
}

В этом месте вы переписываете весь запрос в wordpress index.php.

0
ответ дан 4 December 2019 в 10:13

Теги

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