关于部署VUE项目linux篇

38次阅读

前段时间,因为买的服务器是 window 的,然后写了关于 window 的部署详细过程。然后当时也部署了 Linux 的,但是,但是,不过一周吧,我又忘记了一些。所以我觉得还是写文档记录一下,操作过程。
1、首先,准备好两个工具,xshell、filezilla

 第一个工具是为了连接 Linux,第二个工具是为了比较方便的上传文件到 Linux。

2、使用 xshell 连接的时候。填上对应的地址就行。然后接下来就是点确实啥的,连上去就行。

3、连接成功后,基本上都差补多,然后就是有个 #号

4、初次安装的 nginx 的忽略本步骤.

4.1 删除 nginx 与其配置文件
    sudo apt-get --purge remove nginx
4.2 自动移除全部不适用的软件包
    sudo apt-get autoremove
4.3 列出与 nginx 相关的软件
    dpkg --get-selections|grep nginx
    假如有以下的:nginx                       install
        nginx-common                    install
        nginx-core                  install
4.4 删除 4.3 查询出与 nginx 有关的软件
    sudo apt-get --purge remove nginx
    sudo apt-get --purge remove nginx-common
    sudo apt-get --purge remove nginx-core
4.5 查看 nginx 正在运行的进程,如果有就 kill 掉
    ps -ef |grep nginx
4.6.kill nginx 进程
    sudo kill -9 -8  // 注释 -9 - 8 进程 id
4.7. 全局查找与 nginx 相关的文件
    sudo  find  /  -name  nginx*
4.8 全部删除
    sudo rm -rf file
4.9 重新安装
    sudo apt-get update
    sudo apt-get install nginx

5、nginx 的使用

1. 切换到 nginx 的配置文件夹的目录下
cd /etc/nginx/conf.d 

2. 给对应的网站的配置文件,命名规则:项目名.conf
其实没啥要求主要是为自己好看,然后尾缀为 conf.

3. 对配置 2 进行添加配置参数
sudo vim 你在第二步中写项目名.conf

6、nginx 的 conf 的主要内容


截图没有截取好,但是懒的改,就分为两张了

注意:在每行语句的结束的地方要加上英文的 ;
`
server {

    listen 端口号;
    server_name IP 地址;
    location / {
            root  /var/www/html/gameSystem; // 文件路径
            
            try_files $uri $uri/ @router; 
            
             index  index.html index.htm;  // 主页面
    }
    location /mgr {proxy_pass http://www.baidu.com;  // 跨域的代理}
    location @router {rewrite ^.*$ /index.html last;}

}`

7、好了,保存退出。对于 vim 的操作,百度一下吧
8、重启服务器:

service nginx restart

正文完
 0