Linux 下Nginx 运行Vue
首相基础的安装Node.js npm
先建个目录把 /node/www
然后在这个目录下
wget https://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-x86.tar.xz
解压
tar xf node-v8.11.1-linux-x86
然后创建软链接
#ln -s /node/node-v8.11.1-linux-x86/bin/node /usr/local/bin/node 前面的路径是你下载然后解压后的文件路径
#ln -s /node/node-v8.11.1-linux-x86/bin/npm /usr/local/bin/npm

如果这样就木有问题了
然而在Centos6.9下就有点GG了
错误1
当在CentOS .2下执行某些命令时,有缺少共享库的报错: error while loading shared libraries: libstdc++.so.: cannot open shared object file: No such file or directory yum whatprovides libstdc++.so. yum install libstdc++-4.4.-.el6.i686 后面这个根据出来的换掉
错误2
bash: /usr/local/bin/rar: /lib/ld-linux.so.: bad ELF interpreter: No such file or directory yum install glibc.i686 可能又报错了
error while loading shared libraries: libstdc++.so.: cannot open shared object file: No such file or directory yum install libstdc++.so.
然后就开始安装Vue
npm install -g vue-cli
然后还是创建软链接
sudo ln -s /node/node-v8.11.1-linux-x86/bin/vue /usr/local/bin/vue
然后就开始

然后就按照Vue 官网的安装步骤就OK了
# 创建一个基于 webpack 模板的新项目
$ vue init webpack my-project
# 安装依赖,走你
$ cd my-project
$ npm run dev
跑成功的话会出现 localhost:8080 Ctrl+C关掉
然后我们就开始配置Nginx 了
yum install nginx
对了先cd my-project 进入我的项目
然后编译 -----Vue真的牛逼Js还带编译
npm run build
配置Nginx 的站点
vim /etc/nginx/nginx.conf
只要把端口改一下 然后root 的路径
server {
listen default_server;
listen [::]: default_server;
server_name _;
root /node/www/my-project/dist;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
保存重启
systemctl restart nginx
然后打开的服务器的IP :8080

Vue牛逼
OK!
Linux 下Nginx 运行Vue的更多相关文章
- VMware Linux 下 Nginx 安装配置 - nginx.conf 配置 [负载两个 Tomcat] (三)
首先启动Nginx 1. 相关浏览 两个 Tomcat 配置: VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二) Nginx 安装配置启动: VMware Linu ...
- Linux下nginx编译安装教程和编译参数详解
这篇文章主要介绍了Linux下nginx编译安装教程和编译参数详解,需要的朋友可以参考下 一.必要软件准备1.安装pcre 为了支持rewrite功能,我们需要安装pcre 复制代码代码如下: # y ...
- 【转】Linux下nginx配置https协议访问的方法
一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/ ...
- VMware Linux 下 Nginx
负载 VMware Linux 下 Nginx 安装配置 - nginx.conf 配置 [负载两个 Tomcat] (三) Weiseditor 2014-11-26 23:42 阅读:1 评论 ...
- linux下编译运行驱动
linux下编译运行驱动 嵌入式linux下设备驱动的运行和linux x86 pc下运行设备驱动是类似的,由于手头没有嵌入式linux设备,先在vmware上的linux上学习驱动开发. 按照如下方 ...
- linux安装nodejs运行vue程序
linux安装nodejs运行vue程序 1.与node官网下载安装包 https://nodejs.org/zh-cn/download/ 6.上传到服务器,并解压 tar -xvf node-v1 ...
- linux 下 tomcat 运行报错 Broken pipe
linux 下 tomcat 运行报错 Broken pipe 感谢:http://hi.baidu.com/liupenglover/blog/item/4048c23ff19f1cd67d1e71 ...
- VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二)
准备工作 相关浏览: VMware Linux 下 Nginx 安装配置 (一) 1. 选在 /usr/local/ 下创建 softs 文件夹,通过 ftp 命令 把 apache-tomcat-7 ...
- linux下编译运行TIGL Viewer步骤
linux下编译运行TIGL Viewer步骤(仅为了正确编译安装的话直接跳到步骤3) 1. linux发行版选择:由于linux发行版众多,不同版本包含的库版本可能存在差别,因此需要选择正确的版本. ...
随机推荐
- canvas 绘制坐标轴
结果: 代码: <!DOCTYPE html> <html> <head lang="en"> <meta charset="U ...
- 兼容 数组 api map代码
if(!("map" in Array.prototype)) Array.prototype.map=function(fun){ for(var i=0,arr=[]; i&l ...
- golang日期转字符串,仿照C#中的日期格式结构体
1.日期格式集合.日期转字符串方法 package util import ( "strings" "time" ) //日期格式:模仿java中的结构体 ty ...
- 查看 nginx 的并发连接数
通过查看Nginx的并发连接,我们可以更清除的知道网站的负载情况.Nginx并发查看有两种方法(之所以这么说,是因为笔者只知道两种),一种是通过web界面,一种是通过命令,web查看要比命令查看显示的 ...
- Python之namedtuple源码分析
namedtuple()函数根据提供的参数创建一个新类,这个类会有一个类名,一些字段名和一个可选的用于定义类行为的关键字,具体实现如下 namedtuple函数源码 from keyword impo ...
- 拦截器springmvc防止表单重复提交【2】
[参考博客:http://my.oschina.net/mushui/blog/143397] 原理:在新建页面中Session保存token随机码,当保存时验证,通过后删除,当再次点击保存时由于服务 ...
- Arcgis Desktop连接GIS Servers报错“Proxy server got bad address from remote server ...”
今天打开Arcgis Desktop时突然发现连接GIS Servers报错“Proxy server got bad address from remote server ...” 网上查找到解决方 ...
- 监听Documents文件夹内文件发生改变
// 当Documents内文件发生改变时,启动计时器,每秒计算一次大小,当大小不发生改变时说明传输完毕,就开始刷新. @property (nonatomic, strong) NSTimer *t ...
- 洛谷P2661 信息传递
传送门 题目大意:每个人每一轮可以把消息传给另一个人,问几轮后某个人可以从人 听到自己的消息. 题解:tarjian缩点,求缩点后缩的点包含的最少的点个数. 代码: 正解 #include<io ...
- angular中的 input select 值绑定无效,以及多出一个空白选项问题
问题: <!-- 问题标签 --> <select ng-model="sortType"> <option value="1"& ...