Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Deployment to Azure or Simple NGINX web host

default discord avatar
mrl72 years ago
7

Hey all, I'm having some issues getting the payload server deployed. I have managed to deploy the CMS front end to our basic linux web host. But for some reason, I can't get the API to work at all. I've also tried deploying to Azure web services. That threw out a lot of cors errors which I fixed inside azure but the cors errors still remain.



I've followed through the payload docs but can't seem to make any sense of the deployment process.


When deploying, is there any certain folders that the files need to be placed in? Is there any other config I might be missing?


I am just deploying the build and server files manually via FTP so could very well be missing something.


Can someone help?

  • discord user avatar
    denolfe
    2 years ago

    In order to deploy Payload, you'll need both the dist and build directory after building.



    I can't get the API to work at all

    Providing more detail here would give more info in order to help. Are you able to hit the API at all? Receiving 5XX/4XX errors? Can you provide the cors errors? Do you have the

    serverURL

    property set in your config?

  • default discord avatar
    mrl72 years ago

    Hey Elliot, I managed to get it working on Friday. I had some ports all wrong which was causing the errors.

  • discord user avatar
    denolfe
    2 years ago
    @178109250806087680

    Great to hear!

  • default discord avatar
    reynoldputralast year

    Hello, can u give more detail about deploying payloadCMS using nginx . Im trying to deploy payloadCMS in ubuntu+nginx. I have moved build files to my nginx so i can access my index.html from browser. But its receiving error 404 when requesting js and css file. If i look into index.html, js and css files is located in admin folder, but i dont see them in my build files.



    sorry I'm just learning how to deploy using nginx


    @967118574445547650

    @178109250806087680
  • discord user avatar
    denolfe
    last year

    Have a look at the config in this thread. There might be some ideas there:

    https://payloadcms.com/community-help/github/req-and-user-are-undefined-running-behind-nginx-proxy
  • default discord avatar
    reynoldputralast year

    Thanks a lot

  • default discord avatar
    tomten73last year

    Hi! I'm deploying in the exact same way, nginx reverse proxy that points to the node server that runs locally (EC2 instance, not my machine) on port 3000. However, my issue is a bit different - when i go to mysite.com its successfull but im stuck in an infite loading loop. Looking in the console i get error:


    GET

    http://localhost:3000/api/users/me

    net::ERR_CONNECTION_REFUSED


    Which is strange, cause the payload config has

    serverURL: 'https://mysite.com'

    set and my initial request is successfull and my browser is downloading the js files and hydrating etc etc. So I don't understand why it's trying to communicate with the api like its running on localhost instead of mysite.com?



    Any help would be greatly appreciated!



    EDIT: Apparently setting cors to "*" solved it. Not sure why whitelisting my own domain doesn't work tho.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.