# Complete Recap

### Complete Recap

1. ****Create folder****<span style="white-space: pre-wrap;"> </span>`<span class="editor-theme-code">/opt/apisix</span>`.
2. ****Create and fill****<span style="white-space: pre-wrap;"> </span>`<span class="editor-theme-code">/opt/apisix/apisix.yaml</span>`<span style="white-space: pre-wrap;"> (with </span>`<span class="editor-theme-code">role: data_plane</span>`<span style="white-space: pre-wrap;">, consumers, upstreams, plugin\_configs, routes, and </span>`<span class="editor-theme-code">#END</span>`).
3. ****Make****<span style="white-space: pre-wrap;"> </span>`<span class="editor-theme-code">restart_apisix.sh</span>`<span style="white-space: pre-wrap;"> script that stops any old container and starts a new one, mounting </span>`<span class="editor-theme-code">/opt/apisix/apisix.yaml</span>`<span style="white-space: pre-wrap;"> as both </span>`<span class="editor-theme-code">config.yaml</span>`<span style="white-space: pre-wrap;"> and </span>`<span class="editor-theme-code">apisix.yaml</span>`.
4. ****Run****<span style="white-space: pre-wrap;"> </span>`<span class="editor-theme-code">./restart_apisix.sh</span>`<span style="white-space: pre-wrap;"> to start APISIX.</span>
5. ****Test****<span style="white-space: pre-wrap;"> APISIX locally: </span>`<span class="editor-theme-code">curl -u foo:bar http://127.0.0.1:9080/demo/md/3.0/accounts</span>`.
6. ****Install Nginx****<span style="white-space: pre-wrap;"> (</span>`<span class="editor-theme-code">sudo apt install nginx</span>`).
7. ****Install Certbot****<span style="white-space: pre-wrap;"> (</span>`<span class="editor-theme-code">sudo apt install certbot python3-certbot-nginx</span>`).
8. ****Get SSL****<span style="white-space: pre-wrap;">: </span>`<span class="editor-theme-code">sudo certbot --nginx -d abeta-proxy.finmars.com</span>`.
9. ****Edit Nginx site****<span style="white-space: pre-wrap;"> at </span>`<span class="editor-theme-code">/etc/nginx/sites-available/default</span>`<span style="white-space: pre-wrap;"> to add:</span>  
    ```nginx
    location / {
        proxy_pass http://127.0.0.1:9080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
    ```
10. ****Reload Nginx****<span style="white-space: pre-wrap;"> (</span>`<span class="editor-theme-code">sudo nginx -t</span>`<span style="white-space: pre-wrap;"> then </span>`<span class="editor-theme-code">sudo systemctl reload nginx</span>`).
11. ****Open firewall****<span style="white-space: pre-wrap;"> ports 80, 443, 9080 (</span>`<span class="editor-theme-code">sudo ufw allow ...</span>`).
12. ****Test****<span style="white-space: pre-wrap;"> </span>`<span class="editor-theme-code">https://abeta-proxy.finmars.com/demo/md/3.0/accounts</span>`<span style="white-space: pre-wrap;"> in a browser.</span>
13. ****Auto-renew****<span style="white-space: pre-wrap;"> is handled by Certbot.</span>
14. ****To update****<span style="white-space: pre-wrap;">, edit </span>`<span class="editor-theme-code">/opt/apisix/apisix.yaml</span>`<span style="white-space: pre-wrap;"> and run </span>`<span class="editor-theme-code">./restart_apisix.sh</span>`.

That is the full, clear set of instructions. Now your APISIX runs behind Nginx with a Let’s Encrypt SSL certificate, and you can update the config anytime by editing the file and restarting with the script.