- 修改nginx配置文件,默认地址:/usr/local/etc/nginx/nginx.conf

<title>Welcome to nginx!</title>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
<form action="http://127.0.0.1:81/nginx" enctype="multipart/form-data" method="post">
Username: <input type="text" name="username">
Password: <input type="password" name="password">
"github.com/kataras/iris/v12"
app.Post("/nginx", func(ctx iris.Context) {
name := ctx.FormValue("username")
pw := ctx.FormValue("password")
ctx.JSON(map[string]interface{}{"a": name, "b": pw, "c":200})
err := app.Run(iris.Addr(":81"))
运行
- 后端项目启动

- Nginx启动
- 访问 http:localhost

- 提交表单

- 返回结果
