linux centos7 部署 nodejs 的 express
链接:https://www.youtube.com/watch?v=oGbLL1_0q64
yum install gcc-c++ openssl-devel make -y
cd /tmp
curl -sL https://rpm.nodesource.com/setup | bash -
yum install -y nodejs
npm install -g express-generator
useradd username
passwd username
mkdir first_project
cd first_project/
express
npm install
node ./bin/www &
查看进程那些:netstat -tlpn
如果关掉就是kill端口:sudo kill $(sudo lsof -ti :3000)
or
express expressproject
cd expressproject
npm install
expressproject@0.0.0.0 start /exampleuser/expressproject
node ./bin/www
比如查看express的dome 192.0.0.1:3000
报错问题----------
如果按照npm失败应该事权限啥的那些问题
sudo yum install npm
如果是安装其他的,在contos7中
sudo npm install -g pm2
然后到node项目启动 pm2 start app.js
[root@VM-12-15-centos nginx-1.24.0]# ./configure
-bash: ./configure: Permission denied
出现 Permission denied
错误是由于缺少执行权限。请使用以下命令为 configure 添加执行权限:
chmod +x configure
sudo ./configure
server { listen 81; server_name 120.78.141.70; location / { proxy_pass http://127.0.0.1:8080; } }
参考
https://blog.csdn.net/weixin_41999594/article/details/125465176?spm=1001.2014.3001.5501
https://www.bilibili.com/video/BV11v4y1M7ry/?spm_id_from=333.337.search-card.all.click&vd_source=f47173c6ece362dfbe9a439ae6addcce
修改内容和重新发布需要重启的
重启nginx
sudo systemctl restart nginx # 如果您使用的是 systemd 管理器
sudo /usr/local/nginx/sbin/nginx -s reload # 如果您没有使用 systemd 管理器
第一条命令会发送重启信号给 Nginx 服务,而第二条命令会使用 Nginx 的控制程序重新加载配置文件。
查看端口:
sudo netstat -tunlp | grep 80
连接的工具
server { listen 80; server_name www.****.com; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://localhost:3000; # root html; # index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
2022-10-19 vue实现鼠标移入小图片,大图显示效果