Site updated: 2022-11-04 15:50:27
This commit is contained in:
32
feed.json
32
feed.json
@ -6,6 +6,21 @@
|
||||
"description": "天生我材必有用",
|
||||
"home_page_url": "https://blog.jingxiyuan.cn",
|
||||
"items": [
|
||||
{
|
||||
"id": "https://blog.jingxiyuan.cn/2022/11/04/%E8%AE%B0%E4%B8%80%E6%AC%A1Vue%E9%A1%B9%E7%9B%AE%E7%9A%84%E9%83%A8%E7%BD%B2/",
|
||||
"url": "https://blog.jingxiyuan.cn/2022/11/04/%E8%AE%B0%E4%B8%80%E6%AC%A1Vue%E9%A1%B9%E7%9B%AE%E7%9A%84%E9%83%A8%E7%BD%B2/",
|
||||
"title": "记一次Vue项目的部署",
|
||||
"date_published": "2022-11-04T07:21:00.000Z",
|
||||
"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"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "https://blog.jingxiyuan.cn/2022/11/03/%E4%B8%8A%E7%8F%AD%E4%BA%86/",
|
||||
"url": "https://blog.jingxiyuan.cn/2022/11/03/%E4%B8%8A%E7%8F%AD%E4%BA%86/",
|
||||
@ -240,8 +255,8 @@
|
||||
"tags": [
|
||||
"生活",
|
||||
"心情",
|
||||
"心情",
|
||||
"郁闷"
|
||||
"郁闷",
|
||||
"心情"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -273,19 +288,6 @@
|
||||
"Shoka",
|
||||
"背景音乐"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "https://blog.jingxiyuan.cn/2022/09/23/%E8%A7%A3%E5%86%B3%E5%9F%9F%E5%90%8Dip%E5%8F%98%E5%8A%A8%E5%90%8E%E9%9C%80%E8%A6%81%E9%87%8D%E5%90%AFnginx%E7%9A%84%E9%97%AE%E9%A2%98/",
|
||||
"url": "https://blog.jingxiyuan.cn/2022/09/23/%E8%A7%A3%E5%86%B3%E5%9F%9F%E5%90%8Dip%E5%8F%98%E5%8A%A8%E5%90%8E%E9%9C%80%E8%A6%81%E9%87%8D%E5%90%AFnginx%E7%9A%84%E9%97%AE%E9%A2%98/",
|
||||
"title": "解决域名ip变动后需要重启nginx的问题",
|
||||
"date_published": "2022-09-23T08:17:00.000Z",
|
||||
"content_html": "<p> <em>今天突然发现自己的网站不能访问了。经过一顿排查,发现是家里的外网 ip 变动后 nginx 解析的域名 ip 还是旧 ip 导致的。手动重启 nginx 后恢复正常。但这不是长久之计,如果每次 ip 变动都需要重启一次 nginx,想想都头大。于是查询资料后获得了解决办法,方法如下:</em></p>\n<pre><code class=\"language-yum\">location / {\t\n\tresolver 114.114.114.114 valid=60s; #自定义缓存有效时间间隔对变量中的域名进行解析\n\n\tset $my_server "https://ip:port";\n\n\tproxy_pass $my_server;\n}\n</code></pre>\n",
|
||||
"tags": [
|
||||
"Linux",
|
||||
"服务",
|
||||
"经验分享",
|
||||
"nginx"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user