Proxying nginx to port 1337 with Strapi

Trying to make a proxy from domain: to The proxy is working sort of. If I use port 3000 (which is my main site) it all works, just not on 1337.

I have initialised the strapi-app with “yarn build”, and using pm2 to continuing run Node. Also making sure that port 1337 is allowed in the firewall.

Can anyone possible guess what the issue might be? I have tried almost everything I can think of :-)

This is my nginx configuration:

server {
    index index.html;

    location / {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

My ufw firewall settings:

To                         Action      From
--                         ------      ----
1337/tcp                   ALLOW       Anywhere
1337                       ALLOW       Anywhere
1337/tcp (v6)              ALLOW       Anywhere (v6)
1337 (v6)                  ALLOW       Anywhere (v6)

Strapi-app structure:

someuser@someuser-website:~/api$ ls  api  build  config  extensions  favicon.ico  node_modules  package.json  public  yarn.lock

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there @soduno,

The Nginx configuration actually looks correct. What is the exact error that you get when you visit your API?

Also what I could suggest is making sure that Strapi is listening on the correct port, to do that run the following command:

  1. sudo netstat -plant

Feel free to share the output here.

On another note, what I could also suggest is checking your Nginx error log with the following command:

  1. tail -100 /var/log/nginx/error.log

Regards, Bobby