server { listen 80; server_name www.example1.com ; location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Real-Ip $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect off; } } server { listen 80; server_name www.example2.com; location / { root E:/Example/public; //這裏配置項目的地址從location指定的根目錄開始(/) } } ---------------------