首页 > 其他 > 详细

nginx配置、域名、前端代码部署

时间:2019-03-25 17:52:25      阅读:120      评论:0      收藏:0      [点我收藏+]

服务器上部署nginx,部署多个独立的代码,用nginx做域名映射的配置方法:

  1. 修改/usr/local/nginx/conf/nginx.conf文件,重点是最后一行,include /data/nginx/conf/*vhost;
http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  $remote_addr - $remote_user [$time_local] "$request" 
                      $status $body_bytes_sent "$http_referer" 
                      "$http_user_agent" "$http_x_forwarded_for";

    access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    include /data/nginx/conf/*vhost;
}

  2. 在/data/nginx/conf/ 目录下创建不同的配置文件

技术分享图片

  3.配置对应的配置文件,以hw.keplermarket.cn.vhost为例

server{
    listen 80;
    server_name hw.keplermarket.cn;

    error_log   /data/nginx/logs/hw.keplermarket.cn/error.log;
    location / {
        root       /data/deploy/hw.keplermarket.cn/;
        access_log /data/nginx/logs/hw.keplermarket.cn/access.log main;
        try_files  $uri $uri/ /index.html;
    }
}

  4.放置发布的代码到对应的目录,例如 /data/deploy/hw.keplermarket.cn/ 下放置相应的代码

nginx配置、域名、前端代码部署

原文:https://www.cnblogs.com/yanghaifeng/p/10595032.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!