douoyou3348 2014-07-18 21:09
浏览 76

Nginx Wave Framework API配置问题 - 警告:不支持Nginx HttpRewriteModule

I have searched for a few days and tried various configurations through trial and error but I have not been able to correct my configuration. My specialty is in database design and development so server configuration has been challenging.

I am on a LEMP stack and I installed the Wave Framework. Wave is a PHP micro-framework that is built loosely following model-view-control architecture and factory method design pattern http://www.waveframework.com/wave/doc/index.htm

Surprisingly it's pretty easy to get on your server however I can't resolve one issue. On my server I added in the lines into my nginx config file the Wave suggested and I still get the warning "WARNING: Nginx HttpRewriteModule is not supported, Index Gateway and rewrite functionality will not work, this warning can be ignored if Index Gateway is not used"

Besides this I have been able to use a lot of the features of the Wave Framework and got a portion of my Model and Controller coded.

Please help, my config is pasted below.

nginx.conf

user www-data;

worker_processes 4;

pid /run/nginx.pid;

events {

worker_connections 768; }

http {

sendfile on;

tcp_nopush on;

tcp_nodelay on;

keepalive_timeout 65;

types_hash_max_size 2048;

rewrite_log on;

include /etc/nginx/mime.types;

default_type application/octet-stream;

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

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

gzip on;

gzip_disable "msie6";

include /etc/nginx/conf.d/*.conf;

include /etc/nginx/sites-enabled/*;

}

/etc/nginx/sites-enabled/default (i changed my domain name)

server { listen 80;

 root /usr/share/nginx/www;

   index index.php;   

   server_name *.example.com;

# This is for making sure that files in /resources/static/ folder don't get parsed with PHP

location ^~ /resources/static/ {

  break;

}

error_page 404 /404.html;

  error_page 500 502 503 504 /50x.html;

   location = /50x.html {

         root /usr/share/nginx/www;

   }

# Rewrite that directs everything, except PHP to index file

# Make sure you place this before your "location ~ .php$ {" for the server configuration.

location / {

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

}

# Pass php scripts to the php engine

   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 (output for my domain - wave framework)

SUCCESS: PHP is version 5.3.0 or above (running 5.5.9-1ubuntu4.3)

SUCCESS: PHP setting short_open_tag is enabled

SUCCESS: PDO is supported

SUCCESS: PDO MySQL is supported

...

WARNING: Mcrypt PHP extension is not supported, this is optional and used only when API requests are made with www-crypt-input and www-crypt-output requests

SUCCESS: Zip is supported

SUCCESS: FTP is supported

WARNING: Memcache is not supported, this can be ignored if you do not intend to support Memcache as a caching layer

SUCCESS: GD Graphics Library is supported

SUCCESS: Nginx server is used

WARNING: Nginx HttpRewriteModule is not supported, Index Gateway and rewrite functionality will not work, this warning can be ignored if Index Gateway is not used

SUCCESS: /filesystem/ is writable

SUCCESS: /filesystem/cache/ is writable

...

SUCCESS: /filesystem/data/ is writable

I am not worried about the other warnings beyond the HttpRewriteModule Thank you in advance!

  • 写回答

1条回答 默认 最新

  • duanlie3187 2014-08-06 01:13
    关注

    So I (with help) answered my own question. Anyone who tries Wave Framework with Nginx will encounter this (at least with 3.7.1 current release). Wave Framework has a bug with the Nginx HTTPrewriteModule and the config file the provide for you to implement into your Nginx config is wrong. Below is my etc/nginx/sites-enabled/default config file that works for me.

    # 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;
    }
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c