我已经搜索了几天,并通过试验和错误尝试了各种配置,但我没有能够纠正我的配置。我的专长是数据库设计和开发,所以服务器配置一直具有挑战性。
我在一个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/运行/nginx.pid;
{事件
worker_connections 768;}
http {sendfile;
tcp_nopush;
tcp_nodelay;
keepalive_timeout 65;
types_hash_max_size 2048;
rewrite_log;
包括/etc/nginx/mime.types;
default_type应用程序/八进制;
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/违约(我改了域名)
服务器{听80;
这是为了确保/resources/static/文件夹中的文件不会被PHP解析root /usr/share/nginx/www; index index.php; server_name *.example.com;
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; }
#重写指向所有,除了PHP的索引文件
#确保你把这个放在服务器配置的"location ~ .php${"之前。
location/{
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(输出my domain - wave framework)
我不担心HttpRewriteModule之外的其他警告提前感谢!SUCCESS: PHP is version 5.3.0或以上(running 5.5.9-1ubuntu4.3)
成功:PHP设置short_open_tag是启用的
SUCCESS: PDO is supported
SUCCESS: PDO MySQL is supported
…
警告:不支持Mcrypt PHP扩展,这是可选的,仅当API请求使用www-crypt-input和www-crypt-output请求时使用
SUCCESS: Zip is supported
SUCCESS: FTP is supported
警告:Memcache不被支持,如果你不打算支持Memcache作为缓存层,这个可以忽略
SUCCESS:支持GD图形库
SUCCESS: Nginx server is used
警告:Nginx不支持HttpRewriteModule,索引网关和重写功能将无法工作,如果不使用索引网关,此警告可以忽略
SUCCESS:/filesystem/is writable
SUCCESS:/filesystem/cache/is writable
…
SUCCESS:/filesystem/data/is writable
所以我(在帮助下)回答了我自己的问题。任何尝试使用Nginx的Wave框架的人都会遇到这个问题(至少在当前版本3.7.1中)。Wave框架在Nginx的HTTPrewriteModule中有一个bug,并且提供给你的配置文件是错误的。下面是我的etc/nginx/sites-enabled/默认配置文件。
# 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;
}
}