gpt4 book ai didi

php - Nginx Wave 框架 API 配置问题 - 警告 : Nginx HttpRewriteModule is not supported

转载 作者:行者123 更新时间:2023-12-04 18:52:28 25 4
gpt4 key购买 nike

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

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

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

除此之外,我已经能够使用 Wave 框架的许多特性,并且对我的模型和 Controller 的一部分进行了编码。

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

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
(我更改了我的域名)

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
(我的域的输出 - wave 框架)

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



我不担心 HttpRewriteModule 之外的其他警告
先感谢您!

最佳答案

所以我(在帮助下)回答了我自己的问题。任何尝试使用 Nginx 的 Wave Framework 的人都会遇到这种情况(至少在 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;
}
}

关于php - Nginx Wave 框架 API 配置问题 - 警告 : Nginx HttpRewriteModule is not supported,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24833854/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com