nginx settings location mis-downloading

I’m setting up nginx with php5-fpm on Ubuntu 12.04LTS for wordpress and phpMyAdmin.

My phpMyAdmin locates in/var/www/phpMyAdmin, wordpress in /home/user/workspace/wordpress, MySQL at /var/run/mysqld/mysqld.sock

Read More

I want to map / to wordpress, /phpmyadmin to phpMyAdmin, so how can I achieve this??

WordPress seemed OK, but when accessing /phpmyadmin, the browser “downloads” the request as files…??

This is my current 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;
    }

And, what permission should I set for both the directory wordpress/ and phpMyAdmin/ if all the servers are running as www-data:www-data??
Currently I set them as 755 user:www-data, is that correct??

I haven’t set up server under linux yet, I was using those servers under WinXP, so I’m trying.

Related posts

Leave a Reply

1 comment

  1. in you between location add this

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

    anywhere between
    also
    your missing a server name. type in a server_name example.com;