Skip to content

Digitalocean step by step guide to nginx configuration

Solved Configure
36 2 15.1k 1
  • @phenomlab ok, so i can add https, can i leave the ip or i need to add vfgest.it:3030?

    wrote on last edited by
    #26

    @justoverclock You can use either, but if the API is not meant to be exposed publicly, and should only be accessed by the app itself, then you should use 127.0.0.1. Ultimately, the design is up to you.

  • @justoverclock You can use either, but if the API is not meant to be exposed publicly, and should only be accessed by the app itself, then you should use 127.0.0.1. Ultimately, the design is up to you.

    wrote on last edited by
    #27

    @phenomlab well, i’ve learned something new, no its a private crm developed by me, so no external use 🙂

  • @phenomlab well, i’ve learned something new, no its a private crm developed by me, so no external use 🙂

    wrote on last edited by phenomlab
    #28

    @justoverclock Exactly - that’s why I asked 🙂 You won’t be exposing the API then. Any issues, let me know.

  • @justoverclock Exactly - that’s why I asked 🙂 You won’t be exposing the API then. Any issues, let me know.

    wrote on last edited by
    #29

    @phenomlab ok i’ll try later when people are not using the crm :P, and i’ll post here the result 😄

  • @phenomlab ok i’ll try later when people are not using the crm :P, and i’ll post here the result 😄

    wrote on last edited by
    #30

    @justoverclock No problems.

  • phenomlab phenomlab has marked this topic as solved on
  • phenomlab phenomlab referenced this topic on
  • @justoverclock No problems.

    wrote on last edited by justoverclock
    #31

    @phenomlab its odd but doesn’t work if i use https://vfgest.it:3030 or https://SERVERIP:3030 or https://127.0.0.1:3030

    must be something related to proxy…because server and client are on the same server…but works if i restore all to previous unsecure http connection

  • @phenomlab its odd but doesn’t work if i use https://vfgest.it:3030 or https://SERVERIP:3030 or https://127.0.0.1:3030

    must be something related to proxy…because server and client are on the same server…but works if i restore all to previous unsecure http connection

    wrote on last edited by
    #32

    @justoverclock i’ve found an article that says
    To resolve your issue you can setup nginx to proxy your http backend urls via https. With nginx server you will need to call your api like https://your_domain/api/some_path and nginx will proxy your request to api host, that you will set in config

    so my server actually is on port 3030, what should i do?

    thx!

  • @justoverclock i’ve found an article that says
    To resolve your issue you can setup nginx to proxy your http backend urls via https. With nginx server you will need to call your api like https://your_domain/api/some_path and nginx will proxy your request to api host, that you will set in config

    so my server actually is on port 3030, what should i do?

    thx!

    wrote on last edited by
    #33

    @justoverclock ok i’ve found the solution by myself watching your files…

    -i’ve created a subdomain

    • a new server blocks that proxy requests to the backend endpoint
    • secured with certbot

    all works fine 🍕

  • @justoverclock ok i’ve found the solution by myself watching your files…

    -i’ve created a subdomain

    • a new server blocks that proxy requests to the backend endpoint
    • secured with certbot

    all works fine 🍕

    wrote on last edited by
    #34

    @justoverclock Beat me to it ! I was going to say that you could add another server block to the existing configuration, so for example

    location /api {
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header Host $http_host;
                    proxy_set_header X-NginX-Proxy true;
    
                    proxy_pass http://127.0.0.1:3030/;
                    proxy_redirect off;
    
                    # Socket.IO Support
                    proxy_http_version 1.1;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection "upgrade";
    }
  • @justoverclock Beat me to it ! I was going to say that you could add another server block to the existing configuration, so for example

    location /api {
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header Host $http_host;
                    proxy_set_header X-NginX-Proxy true;
    
                    proxy_pass http://127.0.0.1:3030/;
                    proxy_redirect off;
    
                    # Socket.IO Support
                    proxy_http_version 1.1;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection "upgrade";
    }
    wrote on last edited by
    #35

    @phenomlab 😛 i’m learning ahahahah 🙏

  • @phenomlab 😛 i’m learning ahahahah 🙏

    wrote on last edited by
    #36

    @justoverclock said in Digitalocean step by step guide to nginx configuration:

    i’m learning

    And that’s the whole point of this site 🙂 If you don’t learn anything, you gain nothing.


Did this solution help you?
Did you find the suggested solution useful? Support 💗 Sudonix with a coffee ☕
If your organisation needs deeper expertise around infrastructure, security, or technology leadership, learn more about Phenomlab Ltd. Many of the deeper technical guides behind Sudonix are published there.

Related Topics
  • 4 Votes
    11 Posts
    4k Views
    phenomlab
    @Hari Really? Can you elaborate a bit more here?
  • Error certification on virtualmin/Nginx

    Solved Linux cert virtualmin nginx
    17
    2
    0 Votes
    17 Posts
    7k Views
    phenomlab
    @DownPW anytime
  • Optimum config for NodeBB under NGINX

    Performance nginx performance
    4
    3 Votes
    4 Posts
    2k Views
    phenomlab
    @crazycells hi - no security reason, or anything specific in this case. However, the nginx.conf I posted was from my Dev environment which uses this port as a way of not interfering with production. And yes, I use clustering on this site with three instances.
  • NODEBB: Nginx error performance & High CPU

    Solved Performance performance nodebb nginx
    69
    4
    14 Votes
    69 Posts
    63k Views
    DownPW
    @phenomlab Seems to be better with some scaling fix for redis on redis.conf. I haven’t seen the message yet since the changes I made # I increase it to the value of /proc/sys/net/core/somaxconn tcp-backlog 4096 # I'm uncommenting because it can slow down Redis. Uncommented by default !!!!!!!!!!!!!!!!!!! #save 900 1 #save 300 10 #save 60 10000 If you have other Redis optimizations. I take all your advice https://severalnines.com/blog/performance-tuning-redis/
  • Configure SMTP for Nodebb

    Solved Configure
    14
    5 Votes
    14 Posts
    5k Views
    phenomlab
    @marusaky based on the work completed thus far (in relation to PM exchanges), I’m going to mark this completed. Sending email from the server itself works fine without issue, and DNS appears to be clean (valid SPF, DMARC, and DKIM records). It appears that only Gmail marks incoming messages from your domain as spam - perhaps because of the domain age, which there is nothing we can do to prevent this. Mail delivery to all other domains appears to work fine in al of my tests.
  • speed up my DigitalOcean droplet - Virtualmin

    Solved Configure digitalocean virtualmin
    10
    4 Votes
    10 Posts
    3k Views
    Hari
    @phenomlab thanks for sharing, after four or five months I will migrate to DO 2 or 4gb RAM droplet.
  • nginx can't start again

    Moved Solved Configure nginx server error
    20
    2 Votes
    20 Posts
    6k Views
    phenomlab
    @elhana-fine Yes that will happen of course if you still choose to restart the NGINX service after making a change and the test fails. The test on it’s own will state the error and the line number allowing you to fix that first
  • Virtualmin Letsencrypt Renewal

    Solved Hosting
    13
    1 Votes
    13 Posts
    6k Views
    phenomlab
    @gotwf said in Virtualmin Letsencrypt Renewal: I favor KISS engineering Then I think you’ll be able to appreciate this https://content.sudonix.com/keep-it-simple-stupid/