nginx中的多个服务器块:Php在服务器2上不工作

我有一个在我的networking服务器上运行的nginx服务器。
我想达到以下目的:

  • example.com + www.example.com – > / my / web / dir / www
  • pma.example.com – > / my / web / dir / pma

第一点是没有问题的一切工作正常。 对于第二点,我编辑了/ etc / nginx / sites-enabled / default,并复制了现有的服务器块,为pma.example.com创build一个新的服务器块。

server { listen 80; root /usr/share/nginx/www; index index.php index.html index.htm; server_name example.com www.example.com; location / { try_files $uri $uri/ /index.html; } location ~ (?U)\.php(/.*$|$) { gzip off; #^((?U).*/echo)(/?.+)$; fastcgi_split_path_info ^((?U).+\.php)(/.+)?$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; #try_files $fastcgi_script_name =404; if (!-e $document_root$fastcgi_script_name) { return 404; } fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; } } server { listen 80; root /usr/share/nginx/pma; index index.php index.html index.htm; server_name pma.example.com; location ^~ /{ auth_basic "Restricted Area"; auth_basic_user_file conf/pma_htpasswd; try_files $uri $uri/ /index.html; gzip off; #^((?U).*/echo)(/?.+)$; fastcgi_split_path_info ^((?U).+\.php)(/.+)?$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; #try_files $fastcgi_script_name =404; if (!-e $document_root$fastcgi_script_name) { return 404; } fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; } } 

第一个仍然正常工作,PHP也工作得很好。
第二个不起作用。

我在pma目录下创build了一个index.php文件来testing这些设置:

 <?php phpinfo(); ?> 

不幸的是,如果我在我的浏览器(最新的Chrome)中inputpma.example.com,它只是想下载文件。 我对networking服务器不是很有经验,所以我想请你帮忙。 我怎样才能得到这个工作,我可以在第二个服务器块上使用PHP? 我在这里做错了什么?

我通过digitalocean.com上的本教程解决了这个问题: 如何使用Nginxconfiguration单个和多个WordPress站点设置

我遗漏了WordPress的具体部分,现在它工作得很好。