【发布时间】:2017-09-15 11:35:37
【问题描述】:
我只是下载nginx。然后我进入nginx的目录,将三个命令一一执行如下:
./configure
make
make install
然后我可以访问http://localhost,一切顺利。
现在我正在尝试添加一个 c 模块。这是hello world example。
我所做的是从 Github 下载示例并编辑 nginx (/pathOfNginx/conf/nginx.conf) 的配置文件如下:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
############ this is what I add
location /test {
hello_world;
}
############ done
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
在那之后,我做./configure --add-module=/path/to/nginx-hello-world-module 和make。一切看起来都不错。
然后我重新加载服务器:nginx -s reload
但是,我无法得到正确的答复。这意味着当我执行 curl -i http://localhost/test 时,我得到的是 404 Not Found,而不是 hello world 字符串。
【问题讨论】: