Preface Because the mini program upload requires https, the server https uses the certificate generated by letsencrypt, but Alibaba Cloud OSS does not do https (too lazy to upload the certificate), so I thought of using Nginx proxy to forward the upload request. Nginx Configuration # HTTPS server # server { listen 443 ssl; server_name your.domain.name; ... location / { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $Host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For } location /oss { proxy_set_header Host drift-book-dev.oss-cn-shenzhen.aliyuncs.com; proxy_set_header Connection keep-alive; proxy_pass http://***.oss-cn-***.aliyuncs.com/; #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } Here, the sub-path "/oss" is used as the forwarding path. proxy_pass specifies your Alibaba Cloud domain name. Remember to add a slash "/" at the end, otherwise the forwarding will fail. nginx configure proxy_pass proxy forwarding Assume the following four situations are accessed using http://192.168.1.1/proxy/test.html respectively. The first one: location /proxy/ { proxy_pass http://127.0.0.1/; } Proxy to URL: http://127.0.0.1/test.html The second type (compared to the first type, with one less / at the end) location /proxy/ { proxy_pass http://127.0.0.1; } Proxy to URL: http://127.0.0.1/proxy/test.html The third type: location /proxy/ { proxy_pass http://127.0.0.1/aaa/; } Proxy to URL: http://127.0.0.1/aaa/test.html The fourth type (compared to the third type, with one less / at the end) location /proxy/ { proxy_pass http://127.0.0.1/aaa; } Proxy to URL: http://127.0.0.1/aaatest.html The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: MySQL 5.7.17 installation and configuration method graphic tutorial (windows10)
>>: How to solve jQuery conflict problem
This article example shares the specific code of ...
Redis Introduction Redis is completely open sourc...
Since the default Linux kernel parameters are bas...
A MySQL custom value is a temporary container for...
In the horizontal direction, you can set the cell...
When installing mha4mysql, the steps are roughly:...
Generally, click events will be divided into diff...
Table of contents Nginx load balancing configurat...
Table of contents 1.1Tinyint Type Description 1.2...
This article example shares the specific code of ...
Table of contents 1. Analyzing MySQL from a macro...
Copy code The code is as follows: .sugLayerDiv{ p...
Detailed explanation of MySQL stored procedures, ...
When creating a time field DEFAULT CURRENT_TIMEST...
The tbody element should be used in conjunction wi...