Site updated: 2022-11-04 21:39:11
This commit is contained in:
1 parent
035360f668
commit
8c92f1c7ad
111 files changed
+138
-180
No files matched your search
@@ -14,8 +14,7 @@
|
||||
"content_html": "<h4 id=\"描述\"><a class=\"anchor\" href=\"#描述\">#</a> 描述</h4>\n<ul>\n<li>今天需要把一个 web 项目部署到 ubuntu 服务器上,结果直接使用 apt install nodejs 安装的 nodejs 版本过低,导致编译失败。最后通过查看官网文档获取到了 ubuntu 最新 nodejs 的安装命令。</li>\n</ul>\n<h4 id=\"过程\"><a class=\"anchor\" href=\"#过程\">#</a> 过程</h4>\n<ul>\n<li>卸载旧的 nodejs(此命令会卸载掉相关依赖包)</li>\n</ul>\n<pre><code class=\"language-bash\">sudo apt autoremove --purge nodejs\n</code></pre>\n<ul>\n<li>安装 NodeJS</li>\n</ul>\n<pre><code class=\"language-bash\">curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && sudo apt-get install -y nodejs\n</code></pre>\n<ul>\n<li>安装 yarn</li>\n</ul>\n<pre><code class=\"language-bash\">curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null\n\necho "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list\n\nsudo apt-get update && sudo apt-get install yarn\n</code></pre>\n<ul>\n<li>初始化 (到项目根目录执行)</li>\n</ul>\n<pre><code class=\"language-bash\">yarn install\n</code></pre>\n<ul>\n<li>编译(到项目根目录执行,完成后会生成 dist 目录)</li>\n</ul>\n<pre><code class=\"language-bash\">yarn build\n</code></pre>\n<ul>\n<li>安装 nginx</li>\n</ul>\n<pre><code class=\"language-bash\">apt install nginx\n</code></pre>\n<ul>\n<li>配置 nginx (编译 /etc/nginx/sites-available/default)</li>\n</ul>\n<pre><code class=\"language-conf\">server {\n listen 80 default_server;\n listen [::]:80 default_server;\n\n # SSL configuration\n #\n # listen 443 ssl default_server;\n # listen [::]:443 ssl default_server;\n #\n # Note: You should disable gzip for SSL traffic.\n # See: https://bugs.debian.org/773332\n #\n # Read up on ssl_ciphers to ensure a secure configuration.\n # See: https://bugs.debian.org/765782\n #\n # Self signed certs generated by the ssl-cert package\n # Don't use them in a production server!\n #\n # include snippets/snakeoil.conf;\n\n root /var/www/html;\n\n # Add index.php to the list if you are using PHP\n index index.html index.htm index.nginx-debian.html;\n\n server_name _;\n\n location /api {\n proxy_pass http://localhost:8080;\n }\n\n location / {\n # First attempt to serve request as file, then\n # as directory, then fall back to displaying a 404.\n #try_files $uri $uri/ =404;\n alias /opt/codes/dayu-tools-arbitrage-web/dist/;\n try_files $uri $uri/ @router;\n index index.html index.htm;\n }\n\n location @router {\n rewrite ^.*$ /index.html last;\n }\n}\n\n</code></pre>\n<h4 id=\"其它\"><a class=\"anchor\" href=\"#其它\">#</a> 其它</h4>\n<ul>\n<li>重新编译前需要先删除 dist 目录</li>\n</ul>\n<pre><code class=\"language-bash\">rm dist -fr\n\nyarn build\n</code></pre>\n",
|
||||
"tags": [
|
||||
"Linux",
|
||||
"服务",
|
||||
"经验分享",
|
||||
"项目部署",
|
||||
"vue",
|
||||
"NodeJS",
|
||||
"yarn"
|
||||
@@ -80,8 +79,6 @@
|
||||
"content_html": "<h4 id=\"介绍\"><a class=\"anchor\" href=\"#介绍\">#</a> 介绍</h4>\n<ul>\n<li>ip 直连一般都映射了 5055, 但是直接访问 5055 极空间只提供了 http 协议,如果希望使用 https 协议则必须使用其它端口进行访问。以下方案采用 nginx 反向代理实现,端口使用 10000 举例。<br />\n<img data-src=\"https://file.jingxiyuan.cn/images/2022/10/27/2022-10-27-14-39-25.jpg\" alt=\"\" /></li>\n</ul>\n<h4 id=\"配置\"><a class=\"anchor\" href=\"#配置\">#</a> 配置</h4>\n<ol>\n<li>需要先把 10000 端口在路由器上做好映射。</li>\n<li>证书生成好并放置到 nginx 上。(证书生成方法不做介绍请自行百度)</li>\n<li>http 跳转 https 配置</li>\n</ol>\n<pre><code class=\"language-conf\">server {\n\t\tif ($scheme = http) {\n\t\t\trewrite ^(.*)$ https://$host$1 permanent;\n\t\t}\n}\n</code></pre>\n<ol start=\"4\">\n<li>web 端口监听配置</li>\n</ol>\n<pre><code class=\"language-conf\">#极空间-web\nserver {\n\tlisten 10000 ssl http2; #ipv4\n\tlisten [::]:10000 ssl http2; #ipv6\n\tserver_name xxx.xxx.com; #填写自己的域名,主域名或者子域名\n\n\t#include /etc/nginx/conf.d/ssl/ssl_common.conf;\n\tssl_certificate_key /etc/nginx/conf.d/ssl/xxx.key; #加密证书\n\tssl_certificate /etc/nginx/conf.d/ssl/xxx.pem; #加密证书\n\tssl_session_timeout 1d;\n\tssl_session_cache shared:MozSSL:10m;\n\tssl_session_tickets off;\n\tssl_protocols TLSv1.2 TLSv1.3;\n\tssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;\n\tssl_prefer_server_ciphers on;\n\n #开启OCSP stapling\n\tssl_stapling on;\n\tssl_stapling_verify on;\n\n\tclient_max_body_size 128M;\n\n\tadd_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";\n\n\tproxy_send_timeout 180s; #设置发送超时时间\n proxy_read_timeout 180s; #设置读取超时时间\n\n\t# Prevent Information leaks\n\tproxy_hide_header X-Powered-By;\n\tproxy_hide_header Server;\n\tproxy_hide_header X-AspNetMvc-Version;\n\tproxy_hide_header X-AspNet-Version;\n\n\t# http security headers\n\tadd_header X-Content-Type-Options nosniff;\n\tadd_header Pragma no-cache;\n\tadd_header Cache-Control no-store;\n\tadd_header X-XSS-Protection "1; mode=block";\n\tadd_header Referrer-Policy origin-when-cross-origin;\n\tadd_header X-Permitted-Cross-Domain-Policies none;\n add_header X-Frame-Options SAMEORIGIN; #允许同域嵌套\n\n\t# Add Security cookie flags\n\tproxy_cookie_path ~(.*) "$1; SameSite=strict; secure; httponly";\n\n\t# Path to the root of your installation\n\tlocation / {\n\t\tproxy_intercept_errors on;\n\t\tproxy_max_temp_file_size 0;\n\t\tproxy_set_header Host $host;\n\t\tproxy_set_header X-Real-IP $remote_addr;\n\t\tproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n\t\tproxy_set_header X-Forwarded-Proto $scheme;\n \n\t\tproxy_pass http://极空间内网ip:5055; #这里设置你自己要跳转的局域网应用;\n\t\tproxy_redirect http://域名:5055/home https://域名:10000/home; #极空间在登陆后会跳转到http协议的5055端口,所以要在此替换为https协议的10000端口\n\t}\n\n\terror_page 500 502 503 504 /500.html;\n\terror_page 400 404 /500.html;\n\tlocation = /500.html {\n\t\troot /usr/share/nginx/html/; #错误html\n\t}\n}\n</code></pre>\n<h4 id=\"问题\"><a class=\"anchor\" href=\"#问题\">#</a> 问题</h4>\n<ul>\n<li>需要开启允许嵌套否则登陆后所有应用都是拒绝访问</li>\n<li>需要配置 proxy_redirect 替换响应 url,否则会跳转到默认 http 协议的 5055 端口</li>\n<li>如果配置 proxy_redirect 后无效可能需要清除浏览器缓存(F12 - 网络 - 右键点击 url 区域 - 清除浏览器缓存)</li>\n</ul>\n",
|
||||
"tags": [
|
||||
"极空间",
|
||||
"Docker",
|
||||
"技术分享",
|
||||
"nginx",
|
||||
"极空间",
|
||||
"https",
|
||||
@@ -97,7 +94,6 @@
|
||||
"tags": [
|
||||
"极空间",
|
||||
"Docker",
|
||||
"技术分享",
|
||||
"docker",
|
||||
"青龙面板",
|
||||
"定时任务"
|
||||
@@ -112,7 +108,7 @@
|
||||
"tags": [
|
||||
"极空间",
|
||||
"Docker",
|
||||
"经验分享",
|
||||
"Hexo",
|
||||
"博客",
|
||||
"Hexo",
|
||||
"Shoka",
|
||||
@@ -129,7 +125,6 @@
|
||||
"tags": [
|
||||
"极空间",
|
||||
"Docker",
|
||||
"技术分享",
|
||||
"极空间",
|
||||
"Docker",
|
||||
"mariadb",
|
||||
@@ -145,7 +140,6 @@
|
||||
"tags": [
|
||||
"极空间",
|
||||
"Docker",
|
||||
"技术分享",
|
||||
"博客",
|
||||
"极空间",
|
||||
"Wordpress"
|
||||
@@ -172,7 +166,6 @@
|
||||
"tags": [
|
||||
"Linux",
|
||||
"服务",
|
||||
"经验分享",
|
||||
"nagios",
|
||||
"服务监控"
|
||||
]
|
||||
@@ -186,7 +179,6 @@
|
||||
"tags": [
|
||||
"Linux",
|
||||
"服务",
|
||||
"经验分享",
|
||||
"redis"
|
||||
]
|
||||
},
|
||||
@@ -199,7 +191,6 @@
|
||||
"tags": [
|
||||
"Linux",
|
||||
"服务",
|
||||
"经验分享",
|
||||
"nginx",
|
||||
"iframe",
|
||||
"cookie"
|
||||
@@ -214,7 +205,6 @@
|
||||
"tags": [
|
||||
"Windows",
|
||||
"工具",
|
||||
"经验分享",
|
||||
"PicGo",
|
||||
"chevereto"
|
||||
]
|
||||
@@ -226,8 +216,8 @@
|
||||
"date_published": "2022-10-11T02:40:00.000Z",
|
||||
"content_html": "<h4 id=\"前期准备\"><a class=\"anchor\" href=\"#前期准备\">#</a> 前期准备</h4>\n<p> 首先安装好 svn 和 git 工具。</p>\n<h4 id=\"svn转git\"><a class=\"anchor\" href=\"#svn转git\">#</a> svn 转 git</h4>\n<p>1、 到 svn 项目目录右键选中 gitbash 打开窗口,执行获取用户并映射成 git 样式账号命令如下:<br />\n <code>svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > users.txt</code></p>\n<p> 然后会在目录下生成文件 users.txt 样式如:zhansan = 张三 <span class=\"exturl\" data-url=\"bWFpbHRvOnpoYW5zYW5AeHh4LmNvbQ==\">zhansan@xxx.com</span>。</p>\n<p>2、新建个文件夹,将生成的 users.txt 放入新建的文件夹,然后在新建的文件夹中右键选中 gitbash 弹出窗口后执行下面命令(https://svn_project_url/ 为 svn 库的 url),拉取 svn 代码到本地新建文件夹中。<br />\n <code>git svn clone https://svn_project_url/ --no-metadata --no-minimize-url --authors-file=users.txt</code></p>\n<ul>\n<li>期间可能会弹出 svn 的账户密码验证窗口,正确输入即可。</li>\n</ul>\n<h4 id=\"推送项目到git库\"><a class=\"anchor\" href=\"#推送项目到git库\">#</a> 推送项目到 git 库</h4>\n<p>1、在 gitbash 窗口 cd 到 git 项目文件夹中执行以下命令把 git 仓库地址加入到 remote 中(https://git_project_url/ 为 git 库的 url)。<br />\n <code>git remote add origin https://git_project_url/</code></p>\n<p>2、push 项目到 git 库中。<br />\n <code>git push origin master</code></p>\n",
|
||||
"tags": [
|
||||
"Windows",
|
||||
"工具",
|
||||
"经验分享",
|
||||
"svn",
|
||||
"git"
|
||||
]
|
||||
@@ -241,7 +231,6 @@
|
||||
"tags": [
|
||||
"Linux",
|
||||
"服务",
|
||||
"经验分享",
|
||||
"nginx",
|
||||
"iframe"
|
||||
]
|
||||
@@ -255,8 +244,8 @@
|
||||
"tags": [
|
||||
"生活",
|
||||
"心情",
|
||||
"郁闷",
|
||||
"心情"
|
||||
"心情",
|
||||
"郁闷"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -268,7 +257,6 @@
|
||||
"tags": [
|
||||
"Linux",
|
||||
"服务",
|
||||
"经验分享",
|
||||
"nginx",
|
||||
"负载均衡"
|
||||
]
|
||||
@@ -280,9 +268,9 @@
|
||||
"date_published": "2022-09-26T11:30:00.000Z",
|
||||
"content_html": "<p><em> 今天突然发现博客的音乐无法播放了。经过一顿查找,发现是因为 https://api.i-meto.com/meting/api 调用出错了。shoka 主题应该是通过这个网站提取音乐地址、图片等信息。通过断点发现网易播放列表还是能正常获取的,只是列表中的具体音乐、图片无法获取了。于是自己用获取的列表信息组装出正确的 url 问题基本解决。只针对网易播放列表,图片只能使用一张固定的。</em></p>\n<p><em> 解决方法如下:</em></p>\n<p><em> 到 themes\\shoka\\source\\js_app 目录下打开 player.js 文件,在最底部 init (config) 下加入 vendorJs ('fancybox');,然后找到 56 行用下面的代码替换即可。</em></p>\n<figure class=\"highlight js\"><figcaption data-lang=\"JavaScript\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function-variable function\">fetch</span><span class=\"token operator\">:</span> <span class=\"token keyword\">function</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">source</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre> <span class=\"token keyword\">var</span> list <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre></pre></td></tr><tr><td data-num=\"4\"></td><td><pre> <span class=\"token keyword\">return</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Promise</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">function</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">resolve<span class=\"token punctuation\">,</span> reject</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre> source<span class=\"token punctuation\">.</span><span class=\"token function\">forEach</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">function</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">raw</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre> <span class=\"token keyword\">var</span> meta <span class=\"token operator\">=</span> utils<span class=\"token punctuation\">.</span><span class=\"token function\">parse</span><span class=\"token punctuation\">(</span>raw<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre> <span class=\"token keyword\">if</span><span class=\"token punctuation\">(</span>meta<span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre> <span class=\"token keyword\">var</span> skey <span class=\"token operator\">=</span> <span class=\"token constant\">JSON</span><span class=\"token punctuation\">.</span><span class=\"token function\">stringify</span><span class=\"token punctuation\">(</span>meta<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre> <span class=\"token keyword\">var</span> playlist <span class=\"token operator\">=</span> store<span class=\"token punctuation\">.</span><span class=\"token function\">get</span><span class=\"token punctuation\">(</span>skey<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre> <span class=\"token keyword\">if</span><span class=\"token punctuation\">(</span>playlist<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>\t\t\t <span class=\"token comment\">// 自己修改 - start</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>\t\t\t <span class=\"token keyword\">var</span> audioInfos <span class=\"token operator\">=</span> <span class=\"token constant\">JSON</span><span class=\"token punctuation\">.</span><span class=\"token function\">parse</span><span class=\"token punctuation\">(</span>playlist<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>\t\t\t <span class=\"token keyword\">var</span> neteaseStartUrl <span class=\"token operator\">=</span> <span class=\"token string\">\"https://music.163.com/song/media/outer/url?id=\"</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre>\t\t\t <span class=\"token keyword\">if</spaLine truncated
|
||||
"tags": [
|
||||
"Linux",
|
||||
"服务",
|
||||
"技术分享",
|
||||
"极空间",
|
||||
"Docker",
|
||||
"Hexo",
|
||||
"博客",
|
||||
"Hexo",
|
||||
"Shoka",
|
||||
|
||||
Reference in new issue
Block a user