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