How to use NGINX instead of Apache on DigitalOcean platform?

I believe I saw something whilst searching that you can use NGINX instead of Apache on a Web Service in the DigitalOcean App Platform by adding an nginx.conf file to the root of a project. Despite efforts searching, I can’t find it again, and there’s nothing in the documentation either that I can find.

I tried switching out:

heroku-php-apache2 public/


heroku-php-nginx public/

But the build failed and rolled back. No idea why as the logs provide no more information other than to say it’s failed and rolled back.

In addition to running NGINX thought, as said, I’d also like to be able to have more granular control and the ability to customise the NGINX config. Is this possible?

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.

For the level of control you’re looking for, I’d recommend using a Dockerfile. You can find an example of a PHP Apache Dockerfile on the PHP Project’s Docker Hub page. To use a Dockerfile with App Platform, simply put the Dockerfile in the root of your github project before creating the App Platform app.

If you need to put the file in a subdirectory, or want to add a Dockerfile to an existing project, add the dockerfile_path parameter to your App Spec and apply the changes via doctl or the API.