近日,由于購買的騰訊云服務器要過期了,之前在服務器搭建的cppreference也要重新搭建,故寫下此文章
cppreference的訪問速度也慢,故自己WSL子系統簡單搭鍵一下是個不錯的選擇
環境準備
- 首先,自己先安裝
Nginx
,在網上找安裝教程即可 - 下載
cppreference
網站資源包:https://pan.baidu.com/s/16F-jrxtyRC6vMlyt2TYUuw?pwd=759s ,提取碼:759s
配置Nginx前端文件
- 進入
Nginx Html
目錄,我的路徑是/usr/local/nginx/html
- 將
cppreference
網站資源包在這里解壓,
- 修改
index.html
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p><p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p><p><em>Thank you for using nginx.</em></p><h2><a href="./reference/zh/cpp.html">c++ reference</a></h2></body>
</html>
效果就是輸入WSL子系統的ip地址,簡單的增加一個進入cppreference的鏈接
配置瀏覽器
大家可以自己將ip地址部分替換成自己的ip地址即可,http://172.20.114.39//reference/zh/cpp/headers.html,這樣可以直接進入主頁
然后進入Nginx主目錄的sbin
目錄下輸入./nginx -s reload
重啟nginx