nginx部署nodejs前端项目
2018-01-19 09:34
701 查看
前端项目打包
下载nodejs
下载地址:https://nodejs.org/en/download/执行npm -v,查看安装是否成功。
下载nodejs依赖包
在项目目录下执行 npm iCompiled successfully!
The app is running at:
http://localhost:8007/
项目打包
npm run build打包后的代码保存在 /dist目录下
linux nginx部署前端项目
配置文件:nginx.conf部署项目的配置在 /conf.d/*.conf
server {
listen 9898; #监听的端口
server_name localhost; #域名
location / { #/表示匹配目录下所有文件
root /home/weblogic/hermes/caxs-mds-front; #打包代码所在目录
}
}
重启nginx
nginx -s reload
访问服务器域名:9898,即可访问到前端项目的index页面。
windows系统nginx部署前端项目
配置文件:nginx.confserver {liste
4000
n 8000;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
#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;
}
location / {
proxy_pass http://127.0.0.1:8007/; proxy_redirect default ;
}
location /hermes-web/ {
proxy_pass http://10.10.7.66:8087/hermes-web/; proxy_redirect default ;
}
}重启nginx
nginx.exe -s stop
start nginx.exe
相关文章推荐
- nginx部署前端项目
- nginx部署Vue前端项目
- 如何部署vue前端项目到服务器上(nginx处理跨域)
- 最完美解决Nginx部署ThinkPHP项目的办法
- Ubuntu16.04下Nginx+uwsgi部署Django项目
- Nginx+Tomcat部署Angular+javaweb项目(解决刷新404)
- Vue-router+webpack单页项目服务器部署(nginx)
- Ubuntu+nginx+uwsgi部署Django项目
- Nginx基础配置 前端启动项目
- 阿里巴巴开源项目nginx_concat_module部署实例
- ubuntu 14.04部署python项目(Nginx+uwsgi+django)
- python 在centos上用nginx+Gunicorn部署 flask 项目
- 在服务器上uwsgi+nginx部署Django项目
- 最完美解决Nginx部署ThinkPHP项目的办法
- linux 部署golang 项目(直接部署和基于nginx部署)
- 在Nginx上部署ThinkPHP项目教程
- Diango + uwsgi + nginx项目部署的全过程(可外网访问)
- 从零开始搭建个人网站(6)nginx+uWSGI部署Django项目(上)
- django+gunicorn+nginx部署项目 入门经验
- 在nginx中设置部署项目的路径