이 플러그인은 최근 3개의 주요 워드프레스 출시와 시험 되지 않았습니다. 워드프레스의 좀 더 최근 버전으로 이용할 때 더 이상 관리되지 않고 지원되지 않고 호환성 문제가 있을 수 있습니다.

nginx Compatibility

설명

The plugin solves two problems:

  1. When WordPress detects that FastCGI PHP SAPI is in use, it
    disregards the redirect status code
    passed to wp_redirect. Thus, all 301 redrects become 302 redirects
    which may not be good for SEO. The plugin overrides wp_redirect when it detects
    that nginx is used.
  2. When WordPress detects that mod_rewrite is not loaded (which is the case for nginx as
    it does not load any Apache modules) it falls back to PATHINFO permalinks
    in Permalink Settings page. nginx itself has built-in support for URL rewriting and does not need
    PATHINFO permalinks. Thus, when the plugin detects that nginx is used, it makes WordPress think
    that mod_rewrite is loaded and it is OK to use pretty permalinks.

The plugin does not require any configuration. It just does its work.
You won’t notice it — install and forget.

WARNING: nginx must be configured properly to support permalinks.

nginx Configuration

nginx 0.7.32 and higher:

server {
    server_name mysite.com;

    root /path/to/blog;

    index index.php;

    error_page 404 = @wordpress;
    log_not_found off;

    location ^~ /files/ {
        rewrite /files/(.+) /wp-includes/ms-files.php?file=$1 last;
    }

    location @wordpress {
        fastcgi_pass ...;
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_NAME /index.php;
    }

    location ~ \.php$ {
        try_files $uri @wordpress;
        fastcgi_index index.php;
        fastcgi_pass ...;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
    }

    location ^~ /blogs.dir/ {
        internal;
        root /path/to/blog/wp-content;
    }
}

Older versions:

server {
    server_name mysite.com;

    root /path/to/blog;

    index index.php;

    log_not_found off;
    error_page 404 = @wordpress;

    location ^~ /files/ {
        rewrite /files/(.+) /wp-includes/ms-files.php?file=$1 last;
    }

    location @wordpress {
        fastcgi_pass ...;
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_NAME /index.php;
    }

    location ~ \.php$ {
        if (!-e $request_filename) {
            rewrite ^(.+)$ /index.php break;
            break;
        }

        fastcgi_index index.php;
        fastcgi_pass ...;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
    }

    location ^~ /blogs.dir/ {
        internal;
        root /path/to/blog/wp-content;
    }
}

Of course, do not forget to replace ... in fastcgi_pass with the address/socket
php-cgi is listening on and replace /path/to/blog with the actual path.

Also please note that the path in SCRIPT_NAME should be relative to the DOCUMENT_ROOT (root directive).
Thus, if your WordPress blog resides in http://example.com/blog/, root is set to /path.to/example.com,
SCRIPT_NAME in location @wordpress will be /blog/index.php.

Multi-Site Configuration: the above configs work perfectly with WordPress MultiSite. To make downloads faster, consider adding this line to wp-config.php:

define('WPMU_ACCEL_REDIRECT', true);

Need help with configuring nginx? Contact me: vkolesnikov at odesk dot com, I will try to help you.

설치

  1. Upload nginx-compatibility folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress. The plugins comes in two flavors: PHP4 (experimental) and PHP5. Please activate
    the flavor that matches your PHP version.
  3. That’s all 🙂

FAQ

None yet. Be the first to ask.

후기

2016년 12월 7일
Note: This plugin no longer appears to be maintained. I believe it has been superseded by Nginx Helper, which appears to provide additional functionality, be maintained, and is recommended in the official WordPress Codex. https://wordpress.org/plugins/nginx-helper/
모든 3 평가 읽기

기여자 & 개발자

“nginx Compatibility”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

자국어로 “nginx Compatibility”(을)를 번역하세요.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하세요.

변경이력

0.2.5

  • Added code to prevent path disclosure

0.2.4

  • Updated nginx Configuration section to reflect the changes necessary for WordPress 3.0+

0.2.3

  • Detects nginx when server_tokens is off (props Serge Pokhodyaev)

0.2.2

  • Better HTTPS handling
  • Updated “nginx Configuration” section
  • Fixed a bug with multiple calls to wp_redirect() (props KeRNel_x86)

0.2.1

0.2

  • Added experimental PHP4-compatble version of the plugin

0.1.1

  • Added status code check to wp_redirect

0.1

  • First public release