uni-app 路由mode是history nginx配置

 

uni-app中manifest.json 配置

源碼視圖:

nginx 配置

uni-app:

"h5" : {
        "router" : {
            "mode" : "history",
            "base" : "/wxapp/"
        },
        "title" : "微信體驗",
        "devServer" : {
            "https" : false,
            "disableHostCheck" : true
        },
        "domain" : "",
        "template" : "wxappindex.html"
 }

nginx:

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       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
	gzip on;
        gzip_min_length 1k;
        gzip_buffers 4 16k;
        gzip_comp_level 4;
        gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;

	location / {
	    proxy_redirect off;
	    proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://192.168.0.106:8080;
        }

        location ^~ /wxapp {
            alias  wxapp; # wxapp uni-app H5編譯文件的目錄 
	    try_files $uri $uri/ /index.html last;
            index  index.html;
        }

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

        
    }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章