Wordpress/NGINX 配置问题

Wordpress/NGINX 配置问题

无法让 wordpress 与我的 NGINX 配置配合使用。PhpMyAdmin(快速 Cgi 网关)没问题,但尝试访问时收到 HTTP 404 错误代码http://junon/wordpress/wp-admin/install.php但 junon/phpmyadmin 没问题

worpress的安装路径是/var/www/wordpress。

下面是我的 NGINX 配置

    user  www-data;

worker_processes 1; pid /var/run/nginx.pid; # 必须与 /etc/init.d/file.pid 事件中定义的位置匹配 { worker_connections 1024; }

http {

include    /etc/nginx/mime.types;

server_tokens                   off;
sendfile on;
tcp_nopush   on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts

gzip              on;
gzip_http_version 1.1;
gzip_comp_level 9;
gzip_proxied      any;
gzip_min_length   500;
gzip_disable      "MSIE [1-6]\.";
gzip_types        text/plain text/xml text/css
                  text/comma-separated-values
                  text/javascript
                  application/x-javascript
                  application/atom+xml;

ssl_session_cache   shared:SSL:10m;
ssl_session_timeout 10m;

服务器{

    listen 80;
    server_name             junon;

    location / {
    root        /var/www;
}

location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
            deny all;
    }



    location /phpmyadmin {

           root /usr/share/;
           index index.php index.html index.htm;
           location ~ ^/phpmyadmin/(.+\.php)$ {
                   try_files $uri =404;
                   root /usr/share/;
                   fastcgi_pass 127.0.0.1:3000;
                   fastcgi_index index.php;
                   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                   include /etc/nginx/fastcgi_params;
           }

    location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                   root /usr/share/;
           }
    }

    location /phpMyAdmin {
                   rewrite ^/* /phpmyadmin last;
    }


    location /wordpress {

    try_files $uri $uri/ /index.php?$args;
           root /var/www/wordpress/;
           index index.php index.html index.htm;
           location ~ ^/wordpress/(.+\.php)$ {

                   root /var/www/wordpress/;
                   fastcgi_pass 127.0.0.1:3000;
                   fastcgi_index index.php;
                   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                   include /etc/nginx/fastcgi_params;
           }
    }

}

相关内容