Skip to content

Commit ef1a18a

Browse files
v-weimin@handshakes.com.sgv-weimin@handshakes.com.sg
authored andcommitted
添加默认邮箱和密码值;更新 Nginx 部署文档
1 parent 14e9547 commit ef1a18a

3 files changed

Lines changed: 58 additions & 40 deletions

File tree

AI.DeliciousFood.Web.Client/Views/AccountLogon/LogOn.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@
5656
<section>
5757
<label>
5858
<p>邮箱</p>
59-
<input asp-for="@loginModel.Email" type="email" placeholder=" " />
59+
<input asp-for="@loginModel.Email" type="email" placeholder=" " value="youke@@qq.com" />
6060
<div class="border"></div>
6161
<span asp-validation-for="@loginModel.Email" class="text-danger"></span>
6262
</label>
6363
<label>
6464
<p>密码</p>
65-
<input asp-for="@loginModel.Password" type="password" placeholder=" " />
65+
<input asp-for="@loginModel.Password" type="password" placeholder=" " value="123456" />
6666
<div class="border"></div>
6767
<span asp-validation-for="@loginModel.Password" class="text-danger"></span>
6868
</label>

AI.DeliciousFood.Web.Client/Views/Shared/_Layout.cshtml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@
3939
<li class="nav-item">
4040
<a class="nav-link" asp-controller="RecipeCategories" asp-action="Index">菜谱分类</a>
4141
</li>
42-
<li class="nav-item">
43-
<a class="nav-link" asp-controller="Menu" asp-action="Index">发布菜谱</a>
44-
</li>
42+
@if (SignInManager.IsSignedIn(User))
43+
{
44+
<li class="nav-item">
45+
<a class="nav-link" asp-controller="Menu" asp-action="Index">发布菜谱</a>
46+
</li>
47+
}
4548
</ul>
4649

4750
<!-- 中间空白部分可以用来占位 -->

NGINX_DEPLOYMENT.md

Lines changed: 50 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ cd C:\nginx
3939
New-Item -ItemType Directory -Path "C:\nginx\ssl" -Force
4040
```
4141

42-
将证书文件复制到此目录:
43-
- `C:\nginx\ssl\app.abc.cloud.crt`
44-
- `C:\nginx\ssl\app.abc.cloud.key`
45-
- `C:\nginx\ssl\manage.abc.cloud.crt`
46-
- `C:\nginx\ssl\manage.abc.cloud.key`
42+
将证书文件复制到此目录(证书文件可以是 .pem 或 .crt 格式)
43+
- `C:\nginx\ssl\app.abc.cloud.pem``.crt`(证书文件)
44+
- `C:\nginx\ssl\app.abc.cloud.key`(私钥文件)
45+
- `C:\nginx\ssl\manage.abc.cloud.pem``.crt`(证书文件)
46+
- `C:\nginx\ssl\manage.abc.cloud.key`(私钥文件)
4747

4848
## 三、Nginx 配置
4949

@@ -89,9 +89,9 @@ http {
8989
listen 443 ssl;
9090
server_name app.abc.cloud;
9191
92-
# SSL 证书配置
93-
ssl_certificate ssl/app.abc.cloud.crt;
94-
ssl_certificate_key ssl/app.abc.cloud.key;
92+
# SSL 证书配置(注意:Windows 路径使用正斜杠)
93+
ssl_certificate C:/nginx/ssl/app.abc.cloud.pem;
94+
ssl_certificate_key C:/nginx/ssl/app.abc.cloud.key;
9595
9696
# SSL 安全配置
9797
ssl_protocols TLSv1.2 TLSv1.3;
@@ -147,9 +147,9 @@ http {
147147
listen 443 ssl;
148148
server_name manage.abc.cloud;
149149
150-
# SSL 证书配置
151-
ssl_certificate ssl/manage.abc.cloud.crt;
152-
ssl_certificate_key ssl/manage.abc.cloud.key;
150+
# SSL 证书配置(注意:Windows 路径使用正斜杠)
151+
ssl_certificate C:/nginx/ssl/manage.abc.cloud.pem;
152+
ssl_certificate_key C:/nginx/ssl/manage.abc.cloud.key;
153153
154154
# SSL 安全配置
155155
ssl_protocols TLSv1.2 TLSv1.3;
@@ -225,36 +225,51 @@ cd C:\nginx
225225

226226
## 五、将 Nginx 安装为 Windows 服务
227227

228-
为了让 Nginx 开机自动启动,建议将其安装为 Windows 服务。
229-
230-
### 5.1 使用 NSSM(推荐)
231-
232-
1. **下载 NSSM**
233-
- 访问 [https://nssm.cc/download](https://nssm.cc/download)
234-
- 下载并解压 NSSM
235-
236-
2. **安装 Nginx 服务**
237-
```powershell
238-
# 假设 NSSM 解压到 C:\nssm
239-
cd C:\nssm\win64
240-
.\nssm.exe install NginxService "C:\nginx\nginx.exe"
228+
为了让 Nginx 开机自动启动,建议将其安装为 Windows 服务。
229+
230+
### 5.1 使用 WinSW(推荐)
231+
232+
1. **下载 WinSW**
233+
- 访问 [https://github.com/winsw/winsw/releases](https://github.com/winsw/winsw/releases)
234+
- 下载最新的 `WinSW-x64.exe` 文件
235+
- 将文件重命名为 `NginxService.exe` 并放到 `C:\nginx` 目录
236+
237+
2. **创建配置文件**
238+
239+
`C:\nginx` 目录下创建 `NginxService.xml` 文件:
240+
```xml
241+
<service>
242+
<id>NginxService</id>
243+
<name>Nginx Reverse Proxy</name>
244+
<description>Nginx reverse proxy for DeliciousFood applications</description>
245+
<executable>C:\nginx\nginx.exe</executable>
246+
<startmode>Automatic</startmode>
247+
<logpath>C:\nginx\logs</logpath>
248+
<log mode="roll-by-size">
249+
<sizeThreshold>10240</sizeThreshold>
250+
<keepFiles>8</keepFiles>
251+
</log>
252+
<onfailure action="restart" delay="10 sec"/>
253+
<onfailure action="restart" delay="20 sec"/>
254+
<resetfailure>1 hour</resetfailure>
255+
<stopexecutable>C:\nginx\nginx.exe</stopexecutable>
256+
<stopargument>-s</stopargument>
257+
<stopargument>quit</stopargument>
258+
</service>
241259
```
242260

243-
3. **配置服务**
261+
3. **安装服务**
244262
```powershell
245-
.\nssm.exe set NginxService AppDirectory "C:\nginx"
246-
.\nssm.exe set NginxService DisplayName "Nginx Reverse Proxy"
247-
.\nssm.exe set NginxService Description "Nginx reverse proxy for DeliciousFood applications"
248-
.\nssm.exe set NginxService Start SERVICE_AUTO_START
263+
cd C:\nginx
264+
.\NginxService.exe install
249265
```
250266

251-
4. **启动服务**
267+
4. **启动服务并验证**
252268
```powershell
269+
# 启动服务
253270
Start-Service NginxService
254-
```
255-
256-
5. **查看服务状态**
257-
```powershell
271+
272+
# 查看服务状态
258273
Get-Service NginxService
259274
```
260275

@@ -263,7 +278,7 @@ cd C:\nginx
263278
- **启动服务**: `Start-Service NginxService`
264279
- **停止服务**: `Stop-Service NginxService`
265280
- **重启服务**: `Restart-Service NginxService`
266-
- **卸载服务**: `C:\nssm\win64\nssm.exe remove NginxService confirm`
281+
- **卸载服务**: `C:\nginx\NginxService.exe uninstall`
267282

268283
## 六、IIS 和 ASP.NET Core 应用配置
269284

0 commit comments

Comments
 (0)