我正在使用nginx在我的服务器上安装Wordpress . 我希望获得的配置是:ON www.mydomain.com我想要/ webapps / sitoweb / ON中包含的索引www.mydomain.com/wordpress/我想要我的wordpress

我把wordpress放在文件夹/ var / www /中,我已经配置了nginx,你可以看到(我没有报告代码部分,我在其中声明了ssl的重写规则):

server{

    index  index.html index.htm index.php;
    listen 443;
    ssl on;

    location / {

       alias /webapps/sitoweb/;
       if ($request_uri ~* ".html") { rewrite ^(/.+)\.html$ $scheme://$host$1 permanent;}
       rewrite ^(/.+)\/$ $scheme://$host$1  permanent;
       try_files $uri $uri.html $uri/ =404;
       error_page 404 = /404.html;

       location ~* \.html$ {
           expires -1;
       }

       location ~* \.(css|js|gif|jpe?g|png)$ {
           expires 168h;
           add_header Pragma public;
           add_header Cache-Control "public, must-revalidate, proxy-revalidate";
       }

       location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
       }

     }

       location /wordpress/ {

            alias /var/www/;
            autoindex off;

            location ~ \.php$ {

                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;
            }

    }

现在,如果我去:

  • 在www.mydomain.com/index.html上我获取了/ webapps / sitoweb / [OK!]中包含的索引

  • 在www.mydomain.com/wordpress/readme.html上我可以看到/var/www/readme.html中包含的文件[OK !!]

  • 在www.mydomain.com/wordpress/index.php上找不到文件index.php !!!! [错误]

我强调文件index.php正确地位于目录/ var / www / !!!中

我还在/ webapps / sitoweb /中放了一个文件info.php,我可以在www.mydomain.com/info.php看到它!

Ergo php files under /webapps/sitoweb/ is correctly displayed but php files in /var/www/ is not found!!