nginx使用教程

随笔1周前发布 醍醐灌顶
18 0 0

第一步下载:

        去官网下载:http://nginx.org/en/download.html 稳定版 

第二步:

        解压下载好的文件,将解压好的文件放入没有中文文件名的文件内,我一般会放在桌面,起一个英文名称(code),在打包好的dist文件放在桌面,或者放在(code)文件内

第三步配置文件:




 


 


worker_processes  1;


 


 


 


events {


    worker_connections  1024;


}


 


 


http {


    include       mime.types;


    default_type  application/octet-stream;


 


  


 


    sendfile        on;


 


    keepalive_timeout  65;


 


 


 


    server {


        #端口号


        listen       8080;


        server_name  localhost;


 


    


        #访问的地址


        location / {


            #dist存放的路径


            root   C:UsersWPFDesktopdist;


            #执行的html文件


            index  index.html index.htm;


            #指定访问首页


            try_files $uri $uri/ /index.html;


        }


 


        #代理的服务器


        location /api {


           proxy_pass http://xxxxx;


        }


 


      


    }


 


 


    


 


}

第四步启动:

          在nginx应用程序所在的文件内,启动cmd,输入nginx执行应用程序

nginx使用教程

         依据提示,查找错误,启动程序,启动成功后,在浏览器中输入http://localhost:8080即可对项目进行访问

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...