Skip to content

Commit

Permalink
up. nginx 配置
Browse files Browse the repository at this point in the history
  • Loading branch information
wdssmq committed Jun 29, 2024
1 parent e0c0dc9 commit 1317c7e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions _posts/2021-11-14-Nginx-Rewrite-For-Domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ server {
# …………
}
```

**另外的写法:**
Expand All @@ -74,18 +75,35 @@ server {
# …………
}
```

**其他配置:**

```conf
# 一般和伪静态规则在一起并放在伪静态规则之前
location / {
# 自动添加结尾斜杠
if (!-f $request_filename) {
rewrite ^/([^\.]+[^/])$ $scheme://$host/$1$2/ permanent;
}
# …………
}
```

然后重启 nginx

```bash
/usr/local/nginx/sbin/nginx -s reload

```

下边命令为重启 lnmp

```bash
/root/lnmp restart

```

相关推荐:
Expand All @@ -98,4 +116,6 @@ server {

[「备忘」Nginx 重定向(301)相关\_电脑网络\_沉冰浮水](https://www.wdssmq.com/post/20140819797.html "「备忘」Nginx 重定向(301)相关\_电脑网络\_沉冰浮水") 「当前」

[「笔记」.htaccess 及 nginx.conf 可用变量一览\_电脑网络\_沉冰浮水](https://www.wdssmq.com/post/20220301043.html "「笔记」.htaccess 及 nginx.conf 可用变量一览\_电脑网络\_沉冰浮水")

<!--2346-->

0 comments on commit 1317c7e

Please sign in to comment.