天天看點

Mac通過Brew安裝Nginx的Echo子產品

安裝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      

參考

Nginx入門(二)Nginx echo 子產品的使用

繼續閱讀