zoukankan      html  css  js  c++  java
  • 【五】将vue项目打包至阿里云服务器,并进行配置nginx

    1、安装nginx

    sudo apt-get install nginx

    2、查看nginx是否安装成功、及配置文件位置

    sudo nginx -t
    显示结果:
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful

    3、配置文件

       1)从sites-enabled拷贝一份配置文件default至 /etc/nginx/conf.d/文件夹中,并将后缀名改为.conf

       2)修改conf.d里面的配置文件      

     listen:端口号;
    
     server_name:localhost;
    
     location / { 
    
          root 网站目录;
    
          index index.html,index.htm; 
    
     }

       3)重读配置文件

    sudo nginx -s reload

    然后可以打开浏览器访问,如果现在403错误,有两个可能、

    一个是网站目录没有权限解决方法

    chmod -R 755 网站目录

    另一个是用户不对,编辑

    /etc/nginx/nginx.conf文件,将最上面的user改为你现在启动的用户名。
  • 相关阅读:
    soj#547 bzoj5046 分糖果游戏
    soj#551 loj#2833 帐篷
    nb哒LCA
    soj#532 set p3175
    p4042 [AHOI2014/JSOI2014]骑士游戏
    p1501 [国家集训队]Tree II
    908G New Year and Original Order
    908D New Year and Arbitrary Arrangement
    EZOJ #258
    EZOJ #257
  • 原文地址:https://www.cnblogs.com/youyuan1980/p/14513015.html
Copyright © 2011-2022 走看看