zoukankan      html  css  js  c++  java
  • nginx配置的config文件

    #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       8009;
            server_name  localhost;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location / {
                root   html;
                index  index.html index.htm;
                #前端Vue-router 设置为history模式----↓这行必须加
                try_files $uri $uri/ /index.html;
            }
    
            #配置跨域问题 ↓   项目中的baseUrl 为let baseUrl = "/api"
            location /api/ {
                # 地址是假的,这个是后端的地址填自己的
                proxy_pass http://47.104.81.202:8002;
                # 这句话的意思是对路由进行重写,因为/api为代替后端地址的写在前端项目里,所以在访问的时候不加在后端路径会多加一个api,重写是为了去掉
                rewrite "^/api/(.*)" /$1  break;
            }
            #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;
        #    }
        #}
    
    }
  • 相关阅读:
    MySQL Generic Binaries包和RPM包的区别?
    实体零售如何构建数据管理体系及未来方向
    python3 数据分析
    power designer 资料库表查询
    PowerDesigner 连接资料库
    电商数据分析的基本指标体系
    初中数学动点最值问题19大模型+例题详解
    初中数学全年级26个专题知识点精编汇总
    Python数据分析学习路径拆解及资源推荐
    十种常用的数据分析方法
  • 原文地址:https://www.cnblogs.com/enhengenhengNymph/p/14657305.html
Copyright © 2011-2022 走看看