Nginx - 为DreamVids配置VirtualHost

时间:2014-09-08 13:30:56

标签: nginx

我尝试使用Nginx和PHP-FPM在我的服务器上测试DreamVids(分支v2上的https://github.com/DreamVids/DreamVids)。 但是当我尝试访问它时我遇到了问题,它下载了一个文件。

我的配置是:

    server {
          server_name mydomain.fr;

          root /home/dreamvids/DreamVids;
          index index.html index.htm index.php;

          error_page 404 index.php;
          autoindex off;

          location / {
                try_files $uri /index.php$is_args$args;
                if (!-e $request_filename){
                       rewrite ^(.*)$ /index.php?/$1 break;
                }
          }

          location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                include fastcgi_params;
          }
    }

Thanx寻求帮助

1 个答案:

答案 0 :(得分:0)

server {
    listen   80;

    root /home/dreamvids/DreamVids;
    index index.html index.htm index.php;
    server_name example.com;
    location / {
            try_files $uri /index.php$is_args$args;
            if (!-e $request_filename){
                   rewrite ^(.*)$ /index.php?/$1 break;
            }
      }
            location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            include fastcgi_params;
      }
}