Proxying nginx to port 1337 with Strapi

Posted July 18, 2020 1.9k views

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

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.

Submit an Answer
1 answer

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:

  • 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:

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