zoukankan      html  css  js  c++  java
  • nginx——部署前端

    nginx容器前端文件目录必须为: /usr/share/nginx/html

    html下面是各种文件:js,css,index.html 等。

    其他报错:

    js 找不到

    解决:更改 vue 中,js 路径,使其符合实际情况

    403

    解决:index.html找不到,路径地址错了

    nginx完整配置文件:

    user  www-data;
    worker_processes  2;
    worker_cpu_affinity  01  10;
    pid        /var/run/nginx.pid;
    error_log  /var/log/nginx/error.log warn;
    
    events {
        use epoll;
        worker_connections  1024;
    }
    
    
    http {
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;
    
        client_max_body_size 500m;
    
        resolver 10.43.0.10;
        
    
        
        log_format main '$time_local $remote_addr $remote_user $status '
                        '$request_time $request [$body_bytes_sent/$bytes_sent] '
                        '"$http_user_agent" "$http_referer" "$http_x_forwarded_for"';
    
        access_log  /var/log/nginx/access.log  main;
    
        
        sendfile            on;
        tcp_nopush          on;
        keepalive_timeout   65;
        gzip                on;
    
        
        server {
            listen 80;
            server_name  127.0.0.1;
            charset utf-8;
            
            location / {
                root /usr/share/nginx/html;
                index index.html;
                try_files $uri $uri/ =404;
            }
        }
        
        server {
            listen 8002;
            server_name  127.0.0.1;
            charset utf-8;
            location / {
               proxy_pass http://172.19.168.118:8000/;
            }
        }
    }
    
  • 相关阅读:
    SDOI2019游记
    noi.ac309 Mas的童年
    51nod1237 最大公约数之和
    loj6074 子序列
    noi.ac89A 电梯
    51nod97B 异或约束和
    bzoj4490 随机数生成器Ⅱ加强版
    CF55D Beautiful numbers
    CF24D Broken robot
    CF226D The table
  • 原文地址:https://www.cnblogs.com/pythonwl/p/14313804.html
Copyright © 2011-2022 走看看