【问题标题】:Nginx Wave Framework API configuration issue - WARNING: Nginx HttpRewriteModule is not supportedNginx Wave Framework API 配置问题 - 警告:不支持 Nginx HttpRewriteModule
【发布时间】:2014-09-10 02:44:23
【问题描述】:

我已经搜索了几天并通过反复试验尝试了各种配置,但我无法更正我的配置。我的专长是数据库设计和开发,所以服务器配置一直很有挑战性。

我在 LEMP 堆栈上,我安装了 Wave 框架。 Wave 是一个 PHP 微框架,它松散地遵循模型-视图-控制架构和工厂方法设计模式构建 http://www.waveframework.com/wave/doc/index.htm

令人惊讶的是,它很容易进入您的服务器,但是我无法解决一个问题。在我的服务器上,我在我的 nginx 配置文件中添加了 Wave 建议的行,但我仍然收到警告“警告:不支持 Nginx HttpRewriteModule,索引网关和重写功能将不起作用,如果索引网关不可用,则可以忽略此警告用过”

除此之外,我还能够使用 Wave 框架的许多功能,并且对我的模型和控制器的一部分进行了编码。

请帮忙,我的配置贴在下面。

nginx.conf

用户 www-data;

worker_processes 4;

pid /run/nginx.pid;

事件{

worker_connections 768; }

http {

发送文件;

tcp_nopush 开启;

tcp_nodelay 开启;

keepalive_timeout 65;

types_hash_max_size 2048;

rewrite_log on;

包括/etc/nginx/mime.types;

default_type application/octet-stream;

access_log /var/log/nginx/access.log;

error_log /var/log/nginx/error.log;

gzip 开启;

gzip_disable "msie6";

包括/etc/nginx/conf.d/*.conf;

包括 /etc/nginx/sites-enabled/*;

}

/etc/nginx/sites-enabled/default (我更改了我的域名)

服务器{ 听 80;

 root /usr/share/nginx/www;

   index index.php;   

   server_name *.example.com;

# 这是为了确保 /resources/static/ 文件夹中的文件不会被 PHP 解析

位置 ^~ /resources/static/ {

  break;

}

error_page 404 /404.html;

  error_page 500 502 503 504 /50x.html;

   location = /50x.html {

         root /usr/share/nginx/www;

   }

# 重写将除 PHP 之外的所有内容都指向索引文件

# 确保将其放在服务器配置的“位置 ~ .php$ {”之前。

位置/{

  rewrite ^(.*)$ ./index.php last;

}

#将php脚本传递给php引擎

   location ~ \.php$ {

           try_files $uri =404;

         fastcgi_pass unix:/var/run/php5-fpm.sock;

           fastcgi_index index.php;

           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

           include fastcgi_params;                

} }

http://www.example.com/tools/compatibility.php (我的领域的输出 - Wave 框架)

成功:PHP 版本为 5.3.0 或以上(运行 5.5.9-1ubuntu4.3)

成功:PHP 设置 short_open_tag 已启用

成功:支持 PDO

成功:支持 PDO MySQL

...

警告:不支持 Mcrypt PHP 扩展,这是可选的,仅在使用 www-crypt-input 和 www-crypt-output 请求发出 API 请求时使用

成功:支持 Zip

成功:支持 FTP

警告:不支持 Memcache,如果您不打算支持 Memcache 作为缓存层,可以忽略这一点

成功:支持 GD 图形库

成功:使用了 Nginx 服务器

警告:不支持 Nginx HttpRewriteModule,索引网关和重写功能将不起作用,如果不使用索引网关,可以忽略此警告

成功:/filesystem/ 是可写的

成功:/filesystem/cache/ 是可写的

...

成功:/filesystem/data/ 是可写的

我不担心 HttpRewriteModule 之外的其他警告 提前谢谢!

【问题讨论】:

    标签: php web-services ubuntu nginx web-frameworks


    【解决方案1】:

    所以我(在帮助下)回答了我自己的问题。任何尝试使用 Nginx 的 Wave 框架的人都会遇到这种情况(至少在 3.7.1 当前版本中)。 Wave 框架在 Nginx HTTPrewriteModule 中有一个错误,并且提供给您在 Nginx 配置中实现的配置文件是错误的。下面是适用于我的 etc/nginx/sites-enabled/default 配置文件。

    # this file is /etc/nginx/sites-enabled/default
    
    server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
    
        access_log /var/log/nginx/default/access.log;
        error_log /var/log/nginx/default/error.log;
    
    root /var/www/default;
    index index.php index.html index.htm;
    
        # domain names of this vhost (important if there are more
        # than one vhost on the same IP:PORT combination)
    server_name localhost mydomain.com alias.mydomain.com;
    
        # deny access to .htaccess files
        location ~ /\.ht {
                deny all;
        }
    
        # deny access to hidden files, that is the ones which names that start
        # with . (dot)
        location ~ /\. {
                deny all;
        }
    
        # This is for making sure that files in /resources/static/ folder don't get parsed    with PHP
        location ^~ /resources/static/ {
                break;
        }
    
        # Uncomment to satisfy compatibility check for Nginx rewrite module
    # (based on .htaccess delivered with Wave Framework)
    #   location ~ compatibility\.php$ {
    #       if ($query_string != rewrite_enabled) {
    #           rewrite ^(.*)$ $1?rewrite_enabled break;
    #       }
    #       fastcgi_pass unix:/var/run/php5-fpm.sock;
    #       fastcgi_index index.php;
    #       include fastcgi_params;
    #   }
    
    location / {
        rewrite ^(.*)$ /index.php last;
    }
    
        # Uncomment if you have a custom 404 page
    #error_page 404 /404.html;
    
    # redirect server error pages to the static page /50x.html
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }
    
    # pass the PHP scripts to FastCGI server
    location ~ \.php$ {
    #   fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #   # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }
    }
    

    【讨论】:

      猜你喜欢
      • 2014-06-03
      • 1970-01-01
      • 2012-03-17
      • 2012-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-28
      相关资源
      最近更新 更多