安装echo模块
brew install nginx-full --with-echo-module
# 如果之前安装过nginx
brew unlink nginx
配置hosts文件
$ sudo vim /etc/hosts
127.0.0.1 www.demo.com
配置nginx
server {
listen 80;
server_name demo.com;
location / {
echo $remote_addr;
echo $host;
}
}
测试
$ curl www.demo.com
127.0.0.1
www.demo.com
参考