之前还在说用了CF后,连垃圾评论都没了。
结果,一通电话过来。说如果你再用CF,把IP指在国外,就直接取消备案了。然而CF国内版又用不起,也看了一下怎么个国内加速,还是有点繁琐,所以还是先暂时禁用吧。
其实用CF做代理的时候 ,还能享受直接https,现在我还得自己再配https。真烦人
而且,又开始收到垃圾评论了。
 
忍忍吧
 
在尝试使用 envoy  尝试自动部署的时候,遇到了问题,即:如果我要自己创建一个新的域名,那只能上线去执行 lnmp vhost add 的命令。
为什么要使用 lnmp 呢?其实他对我的作用只有一个,多版本的 PHP。因为现在在线上,各种不同版本的 PHP 都在跑,有 PHP5.6 / PHP7.1 / PHP8.1估计后面还会有更多的版本。
 
于是,我就想着用 expect 来处理
sudo /usr/bin/expect<<EOF
spawn lnmp vhost add
expect {
    "Please enter domain" {send "{{$host}}\n";exp_continue}
    "Enter more domain name"  {send "\n";exp_continue}
    "Please enter the directory" {send "\n";exp_continue}
    "Allow Rewrite rule" {send "y\n";exp_continue}
    "Default rewrite" {send "laravel\n";exp_continue}
    "Enable PHP Pathinfo" {send "\n";exp_continue}
    "Allow access log" {send "\n";exp_continue}
    "Enable IPv6" {send "\n";exp_continue}
    "Enter your choice " {send "\n";exp_continue}
    "Add SSL Certificate" {send "\n";exp_continue}
    "Press any key to start" {send "\r"; exp_continue}
}
expect eof
EOF
 
但执行后一直报错:
[mpass]: expect: spawn id exp3 not open
[mpass]: while executing
[mpass]: "expect eof"
 
 
仔细查了半天,原来最后一句还用了 exp_continue。。expect 认为还没有执行完。所以。就行报错了。
将最后一个 exp_contiue 删除。再次执行,就正常了
XML/HTML代码
    - @task('lnmp' ,['on'=>'dev'])  
 
    -   
 
    - @if($force)  
 
    -     sudo rm -rf /usr/local/nginx/conf/vhost/{{$host}}.conf  
 
    -     sudo rm -rf /home/wwwroot/{{$host}}  
 
    - @endif  
 
    - sudo /usr/bin/expect<<EOF  
 
    - spawn lnmp vhost add  
 
    - expect {  
 
    -     "Please enter domain" {send "{{$host}}\n";exp_continue}  
 
    -     "Enter more domain name"  {send "\n";exp_continue}  
 
    -     "Please enter the directory" {send "\n";exp_continue}  
 
    -     "Allow Rewrite rule" {send "y\n";exp_continue}  
 
    -     "Default rewrite" {send "laravel\n";exp_continue}  
 
    -     "Enable PHP Pathinfo" {send "\n";exp_continue}  
 
    -     "Allow access log" {send "\n";exp_continue}  
 
    -     "Enable IPv6" {send "\n";exp_continue}  
 
    -     "Enter your choice " {send "\n";exp_continue}  
 
    -     "Add SSL Certificate" {send "\n";exp_continue}  
 
    -     "Press any key to start" {send "\r";}  
 
    - }  
 
    - expect eof  
 
    - EOF  
 
    - ls -lah /home/wwwroot/  
 
    - @endtask  
 
 
这样就 OK 了
 
 
之前本来有准备写内容,但不知道 怎么回事编辑器加载不出来直接报错,于是就放弃了。
10月没做什么事情,但大致流水账可以记一下:
1、Flutter 又重捡起来了,后面重心可能会在这一块 (安装个开发工具折腾了1天,主要是SDK更新,一更就死)
2、小程序 还在写,但下一波估计不用 UniAPP,可能会考虑Taro。
3、升级了操作系统到最新的,目前 没问题
4、又买了两台无忧。好象Zerotier会影响网速?准备重建一下planet。估计又要大折腾
 
新项目还是要上,老本没地儿吃了
 
 
在使用 phpstorm/webstorm 进行前端开发的时候,一般会设置 alias,比如@,但在 IDEA 中,如果项目是 vite/vuejs 的时候 ,无法识别路径。
网上教程很多,什么设置.eslintrc.js / jsconfig.json / tsconfig.json 之类的,但其实重启 IDE 后仍然无法识别。
 
查了一下资料,原来目前 phpstorm 对@的 alias,只支持 webpack,也就是说,如果你的前端项目是 webpack 的,其实是能够识别的。因此,只要在项目根目录下,随便建一个文件,尽量不要叫 webpack.config.js,以防被项目自动识别。你可以建一个 alias.config.js,内容如下:
JavaScript代码
    - const path = require("path");  
 
    - module.exports = {  
 
    -   resolve: {  
 
    -     alias: {  
 
    -       '@': path.resolve(__dirname, 'resources/js'),  
 
    -       '~': path.resolve(__dirname, 'resources')  
 
    -     }  
 
    -   }  
 
    - }  
 
 
 
看到这个 resource/js 就知道当前是在 laravel 项目下面了。
在 Ide 的 setting中 :
Languaes & Frameworks > Javascript > Webpack ,选择手动,指定 alias.config.js ,确定后,再打开 *.vue 文件,会发现原来的 import 文件都能够自动识别了。
 
 
 解决 tailwindCss 与 elementUI 最简单办法就是
1、在 app.js(或main.js)中,先加载 tailwindCss 再加载 elementUI 和相关 css
2、在 tailwind.config.js 中,plugins节点下,增加:
JavaScript代码
    - plugin(function ({addBase}) {  
 
    -   addBase({  
 
    -     ".el-button": {  
 
    -       "background-color": "var(--el-button-bg-color,val(--el-color-white))"  
 
    -     }  
 
    -   })  
 
    - }),  
 
 
 
 
说白了,就是继续针对 el-button 重新赋值。
再打开页面就完全正常了。