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 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条