You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/07/07 08:58:01 UTC

[GitHub] [apisix] CGerAJ edited a comment on issue #4544: request help: How to configure a single-page application(SPA) in APISIX?

CGerAJ edited a comment on issue #4544:
URL: https://github.com/apache/apisix/issues/4544#issuecomment-875422045


   Thanks for the answer @membphis @Yiyiyimu 
   
   Train of thought
   
   ```
   client -> apisix(80) -> 127.0.0.1:8000(local nginx)
   ```
   
   
   
   this is my config
   
   step1: You should modify config.yaml
   ```
   nginx_config:
       main_configuration_snippet: |
           daemon on;
       http_configuration_snippet: |
           server {
               listen  8099;
               server_name  localhost;
               charset utf-8;
               location / {
                   # Your SPA build file like this
                   root /usr/share/nginx/html;
                   try_files $uri $uri/ /index.html;
                   expires      -1s;
              }
           }
           chunked_transfer_encoding on;
   
       http_server_configuration_snippet: |
           set $my "var";
       http_admin_configuration_snippet: |
           log_format admin "$request_time $pipe";
       http_end_configuration_snippet: |
           server_names_hash_bucket_size 128;
       stream_configuration_snippet: |
           tcp_nodelay off;
   
   ```
   
   
   step2: config you apisix route, Here’s a reference configuration.
   
   ```
   {"code":0,"message":"","data":{"id":"362576314554647276","create_time":1625641924,"update_time":1625643730,"uris":["/*"],"name":"vue3","desc":"SPA","priority":1,"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS","CONNECT","TRACE"],"hosts":["you host address"],"upstream":{"nodes":[{"host":"127.0.0.1","port":8099,"weight":1}],"retries":2,"timeout":{"connect":6,"read":6,"send":6},"type":"roundrobin","scheme":"http","pass_host":"pass"},"status":1},"request_id":"927ec2b0-559f-4465-bfcb-38edb2384786"}
   
   ```
   
   
   
   Points to note:
   -  YAML file format
       YAML file format can not be wrong, you can test your configuration through `apisix reload`
   -  Permission denied
      I am not particularly familiar with this area and need to check the directory file permissions level by Level.
      Official QQ552030619 exchange group solved my problem, thank you very much
   
   
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org