当前位置: 首页 > news >正文

nginx 安装配置

1.vue 打包发布后的dist下面的文件,通过nginx作为服务代理,可以发送到后台接口,将原来的目录下的删除拷贝到这个目下面

2.nginx.conf做如下配置


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


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;

    server {
        listen       8080;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

		location /wfpt-web {
			proxy_pass   http://localhost:9090/wfpt-web/;
		}

        #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;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

3.nginx 启动

启动:start nginx

停止:nginx -s stop 或者 nginx -s quit

注:stop是快速停止nginx,可能并不保存相关信息;quit是完整有序的停止nginx,并保存相关信息。

重新载入:nginx -s reload

查看版本:nginx -v

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • Win7 家庭版远程连接问题
  • mysql 表结构文档整理
  • mysql分组获取最大时间的数据
  • CentOS7 查找应用名称并关闭进程的定时任务
  • CentOS7 yum安装步骤
  • CentOS7 RabbitMQ安装
  • CentOS7 查看目录大小
  • JS计算两个日期的时间差
  • 根据实体生成sql xml需要的
  • 常用的Jquery验证
  • JS根据身份证号计算年龄
  • RPC服务和HTTP服务对比
  • SFTP秘钥的方式登录与LFTP
  • IDEA 设置自动生成代码
  • IDEA光标上一次位置快捷键
  • 345-反转字符串中的元音字母
  • C++类中的特殊成员函数
  • canvas绘制圆角头像
  • React as a UI Runtime(五、列表)
  • SpingCloudBus整合RabbitMQ
  • 从setTimeout-setInterval看JS线程
  • 大型网站性能监测、分析与优化常见问题QA
  • 基于webpack 的 vue 多页架构
  • 前端存储 - localStorage
  • 数据结构java版之冒泡排序及优化
  • 算法-图和图算法
  • 通过来模仿稀土掘金个人页面的布局来学习使用CoordinatorLayout
  • 微信小程序实战练习(仿五洲到家微信版)
  • 异常机制详解
  • 400多位云计算专家和开发者,加入了同一个组织 ...
  • AI又要和人类“对打”,Deepmind宣布《星战Ⅱ》即将开始 ...
  • # centos7下FFmpeg环境部署记录
  • #565. 查找之大编号
  • #nginx配置案例
  • (C#)获取字符编码的类
  • (ZT)一个美国文科博士的YardLife
  • (补充):java各种进制、原码、反码、补码和文本、图像、音频在计算机中的存储方式
  • (附源码)apringboot计算机专业大学生就业指南 毕业设计061355
  • (附源码)spring boot网络空间安全实验教学示范中心网站 毕业设计 111454
  • (附源码)springboot学生选课系统 毕业设计 612555
  • (剑指Offer)面试题34:丑数
  • (图文详解)小程序AppID申请以及在Hbuilderx中运行
  • (五)Python 垃圾回收机制
  • (转)大型网站的系统架构
  • (自用)网络编程
  • .NET 8 编写 LiteDB vs SQLite 数据库 CRUD 接口性能测试(准备篇)
  • .NET C# 配置 Options
  • .net core 6 使用注解自动注入实例,无需构造注入 autowrite4net
  • .net on S60 ---- Net60 1.1发布 支持VS2008以及新的特性
  • .Net Redis的秒杀Dome和异步执行
  • .NET 项目中发送电子邮件异步处理和错误机制的解决方案
  • //usr/lib/libgdal.so.20:对‘sqlite3_column_table_name’未定义的引用
  • @JSONField或@JsonProperty注解使用
  • @Mapper作用
  • @media screen 针对不同移动设备