From 9673452e2022652d5cf5b38c5fa5bdc84d79a711 Mon Sep 17 00:00:00 2001 From: Minho Date: Sun, 25 Mar 2018 16:53:01 +0800 Subject: [PATCH] =?UTF-8?q?Updated=20=E9=85=8D=E5=90=88nginx=E8=AE=A9MinDo?= =?UTF-8?q?c=E8=BF=90=E8=A1=8C=E5=9C=A8=E4=BA=8C=E7=BA=A7=E5=AD=90?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=20(markdown)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 配合nginx让MinDoc运行在二级子目录.md | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/配合nginx让MinDoc运行在二级子目录.md b/配合nginx让MinDoc运行在二级子目录.md index da00310..9804c42 100644 --- a/配合nginx让MinDoc运行在二级子目录.md +++ b/配合nginx让MinDoc运行在二级子目录.md @@ -5,5 +5,35 @@ 之后,在nginx中配置路由规则,将属于MinDoc的路由重定向到MinDoc端口。配置如下: ``` +server { + listen 443; + server_name www.iminho.me; + add_header X-Content-Type-Options nosniff; + charset utf-8; + error_page 500 502 503 504 /50x.html; + access_log /var/log/nginx/www.iminho.me/access.log main; + set $root_path '/var/www/www.iminho.me/mindoc'; + root $root_path; + try_files $uri $uri/ @rewrite; + index index.php index.html; + location /50x.html { + root /var/www/html; + } + #此处是关键 + location /wiki/ { + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-Proto $scheme; + #此处配置 MinDoc 程序的地址和端口号 + proxy_pass http://127.0.0.1:8182/; + } + location / { + try_files $uri $uri/ /index.php?$query_string; + } + location ~* ^/(css|img|js|flv|swf|download)/(.+)$ { + root $root_path; + expires 30m; + } +} ``` \ No newline at end of file