mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-11-24 16:53:22 +08:00
Created 使用Nginx做反向代理 (markdown)
39
使用Nginx做反向代理.md
Normal file
39
使用Nginx做反向代理.md
Normal file
@@ -0,0 +1,39 @@
|
||||
Nginx的配置文件如下:
|
||||
|
||||
```
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
#此处应该配置你的域名:
|
||||
server_name webhook.iminho.me;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
#此处配置你的访问日志,请手动创建该目录:
|
||||
access_log /var/log/nginx/webhook.iminho.me/access.log;
|
||||
|
||||
location ~ .*\.(ttf|woff2|eot|otf|map|swf|svg|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ {
|
||||
|
||||
#此处将路径执行 MinDoc 的跟目录
|
||||
root "/var/go/godoc";
|
||||
expires 30m;
|
||||
}
|
||||
|
||||
|
||||
location / {
|
||||
try_files /_not_exists_ @backend;
|
||||
}
|
||||
|
||||
# 这里为具体的服务代理配置
|
||||
location @backend {
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
#此处配置 MinDoc 程序的地址和端口号
|
||||
proxy_pass http://127.0.0.1:8181;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
如果你的网站开启了HTTPS,需要注意参数 `X-Forwarded-Proto`,如果后端获取到的不是https,请手动设置该参数为https。
|
||||
Reference in New Issue
Block a user