Nginx设置位置下载错误


nginx settings location mis-downloading

我正在Ubuntu 12.04LTS上为wordpress和phpMyAdmin设置nginx与php5-fpm。

我的phpMyAdmin位于/var/www/phpMyAdmin, wordpress在/home/user/workspace/wordpress, MySQL在/var/run/mysqld/mysqld.sock

我想映射/到wordpress, /phpmyadmin到phpMyAdmin,所以我怎么能做到这一点??

Wordpress似乎没问题,但当访问/phpmyadmin时,浏览器"下载"请求作为文件…??

这是我当前的nginx.conf:

server {
    listen 8000;
    root /home/user/workspace/wordpress;
    index index.html index.htm index.php;'
    location ~* /phpmyadmin { #TODO: shall here be a  tailing slash??
        #TODO: root or alias???
    }
    location ~ '..*/.*'.php$ {
        return 403;
    }
    location / {
        #TODO: show the following line be un-commented??
        #try_files $uri $uri/ /index.php?q=$uri&$args;
        # Uncomment to enable naxsi on this location
        # include /etc/nginx/naxsi.rules
    }
    location ~ '.php$ {
        fastcgi_split_path_info ^(.+'.php)(/.+)$;
        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        fastcgi_intercept_errors on;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;#TODO: could this being removed??
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    #FIXME: and how to block all access to /home/user/workspace/wordpress/server.d/*
    #This doesn't work??
    location /sever'.d {
        autoindex on;
        deny all;
    }

并且,如果所有服务器都以www-data:www-data的身份运行,我应该为目录wordpress/phpMyAdmin/设置什么权限?目前我将它们设置为755 user:www-data,这是正确的吗??

我还没有在linux下设置服务器,我在WinXP下使用那些服务器,所以我正在尝试。

在你之间的位置添加这个

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:9000;
                   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;
    }

之间也您丢失了服务器名称。输入server_name example.com;