2013-04-27 64 views
1

我设置了nginx php5-fpm在Ubuntu 12.04LTS for wordpress和phpMyAdmin。nginx设置位置错误下载

我的phpMyAdmin的座落在/var/www/phpMyAdmin,在/var/run/mysqld/mysqld.sock

我要地图/到WordPress,/phpmyadmin到phpMyAdmin WordPress的在/home/user/workspace/wordpress,MySQL的,所以我怎么能做到这一点?

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

而且,我要两个目录wordpress/phpMyAdmin/设置什么权限,如果所有的服务器都运行为www-data:www-data? 目前我将它们设置为755 user:www-data,是否正确?

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

回答

1

位置之间添加此

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;

+0

所以我必须为phpmyadmin安装另一个cgi处理程序? – user1034937 2013-04-29 15:26:59